ServiceStack.OrmLite | Fast , Simple , Typed ORM for .NET | Database library
kandi X-RAY | ServiceStack.OrmLite Summary
kandi X-RAY | ServiceStack.OrmLite Summary
Follow @ServiceStack, view the docs, use StackOverflow or Customer Forums for support.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ServiceStack.OrmLite
ServiceStack.OrmLite Key Features
ServiceStack.OrmLite Examples and Code Snippets
Community Discussions
Trending Discussions on ServiceStack.OrmLite
QUESTION
I've got following setup: C#, ServiceStack, MariaDB, POCOs with objects and structs, JSON.
The main question is: how to use ServiceStack to store POCOs to MariaDB having complex types (objects and structs) blobbed as JSON and still have working de/serialization of the same POCOs? All of these single tasks are supported, but I had problems when all put together mainly because of structs.
... finally during writing this I found some solution and it may look like I answered my own question, but I still would like to know the answer from more skilled people, because the solution I found is a little bit complicated, I think. Details and two subquestions arise later in the context.
Sorry for the length and for possible misinformation caused by my limited knowledge.
Simple example. This is the final working one I ended with. At the beginning there were no SomeStruct.ToString()/Parse()
methods and no JsConfig
settings.
ANSWER
Answered 2021-Apr-02 at 09:19ServiceStack treats structs like a single scalar value type, just like most of the core BCL Value Types (e.g. TimeSpan
, DateTime
, etc). Overloading the Parse()
and ToString()
methods and Struct's Constructor
let you control the serialization/deserialization of custom structs.
Docs have been corrected. Structs use
Parse
whilst classes useParseJson/ParseJsv
If you want to serialize a models properties I'd suggest you use a class
instead as the behavior you're looking for is that of a POCO DTO.
If you want to have structs serailized as DTOs in your RDBMS an alternative you can try is to just use JSON.NET for the complex type serialization, e.g:
QUESTION
I'm using ServiceStack.OrmLite, and when trying to set the default column definition for DateTime, I can’t manage to get the column to be nullable. Everything else sticks, but "NULL" is somehow converted into "NOT NULL".
In my example code below I've set ColumnDefinition => "DATETIME(6) NULL DEFAULT...
and when running it, it creates a table with DATETIME(6) NOT NULL
...
ANSWER
Answered 2020-Nov-20 at 13:36If you want to specify a nullable ValueType RDBMS column it needs to be nullable on the C# Type, e.g:
QUESTION
I have updated ServiceStack to latest version on a project and now this line seems to be giving me issues:
...ANSWER
Answered 2020-Aug-26 at 03:22This isn't going to be an issue with OrmLite which just sends the SQL as-is to Npgsql ADO.NET provider which is returning the server PostgreSQL error.
For some reason the connection string doesn't have visibility or access to your product_book
materialized view, some potential issues could be the user may not have access to it, or it's in a different schema.
QUESTION
After installing ServiceStack.OrmLite.SqlServer NuGet Packages, I started getting below error out of no clue.
...ANSWER
Answered 2020-Jun-12 at 13:13This indicates you have different version of ServiceStack packages. You need to make sure that all packages have the same version, e.g. 5.9.0.
Or if you're using the pre-release MyGet packages (e.g ending 5.*.1) then you'll need to clear out your NuGet packages cache so you can download the latest version, e.g:
QUESTION
I've made a custom auth provider for LDAP (Active Directory) based on the CredentialsAuthProvider. Following the docs I've overridden TryAuthenticate and OnAuthenticated, returning true at the end. I've also tried without OnAuthenticated.
I'm using UseDistinctRoleTables
for the OrmLiteAuthRepository, and I've observed in the tables that roles are being created in UserRole.
However I'm getting the exception: ArgumentNullException. Fieldname "s".
...ANSWER
Answered 2020-Mar-20 at 19:34The issue is ServiceStack's AuthenticateService
is trying to populate the AuthenticateResponse
Roles and Permissions but your Custom AuthProvider isn't populating the session.UserAuthId
which is used to query the Auth Repository for the roles.
The solution is for your Custom AuthProvider to populate the Sessions UserAuthId
with the Id of the Authenticated User.
You can also prevent this Exception by disabling ServiceStack from trying to populate the Roles/Permissions by setting IncludeRolesInAuthenticateResponse=false
, e.g:
QUESTION
I started a ServiceStack ASP.NET Empty project in VS2019, as that was the closest thing I could find to what I wanted. The template is right on, but I want to run it in .NET Core.
However, the Target framework was set to .NET Framework 4.5, but I wanted it to be .NET Core 2.1+, and I cannot select it either:
I know that I have .NET Core installed, because I have been developing a Blazor app also in VS2019, which is .NET Core.
I'd like to know what I am missing here.
EditHere is the csproj file for the project containing the AppHost.cs
...ANSWER
Answered 2019-Aug-15 at 13:01Try to open your .csproj
for editing and put netcoreapp2.1
as your target framework.
QUESTION
I get a runtime error when using ServiceStack.OrmLite.Core
package (5.4.1) and trying to get a ModelDefinition
(ServiceStack.OrmLite.ModelDefinition
) by doing:
ANSWER
Answered 2019-Feb-20 at 02:05In trying to repro this I've resolved a different issue with the ASP.NET Core Apps on the .NET Framework templates referencing the latest v5.4.1 MyGet packages where the Tests .csproj should be referencing the new ServiceStack.Kestrel.Core
package instead of ServiceStack.Kestrel
, i,e:
QUESTION
I am posting this question here, as I'm still waiting for approval on the ServiceStack customer forum. It's a rather specific question, so I don't expect many can help... @mythz :)
I'm migrating ServiceStack from v5.4 to v5.7 and there is an issue with aliases in SqlExpression
.
I wrote a custom sql concat to get a "kind-of-csv-format" in one column, to merge data into one column, when using unions. From the SQL side, simplified version would be:
...ANSWER
Answered 2019-Nov-21 at 12:05I've changed it to not use the alias when the alias is the same name in this commit.
This change is available from the latest v5.7.1 that's now available on MyGet.
QUESTION
I have an implementation, where I am calling an autoquery operation via the service gateway. The service gateway will successfully call both internal and external operations. However, any autoquery operation fails because it is not getting the connection string set. These same autoquery operations work just fine when called directly and not through the gateway.
Here is the stack trace.
...ANSWER
Answered 2019-Oct-01 at 13:02Request Filter Attributes like [ConnectionInfo]
is only applied on HTTP Requests, not internal Service Gateway requests.
The Connection info isn't configured because it's not annotated on your PostContact
Service Request DTO that calls the in-procces Service Gateway.
You can have the [ConnectionInfo]
on the QueryFiles
AutoQuery Request DTO attached to the current Request with:
QUESTION
To elaborate what I try to achieve with servicestack.ormlite. Imagine that a franchise business has some branches, each branch has system and local database, all of these database are replicating each other. In the system, each model is with a property called store_id like below.
...ANSWER
Answered 2019-Jul-20 at 16:09This question is still unclear on what answer it wants, the screenshot says it doesn't know which API to use to filter by store_id but your screenshot includes 2 different examples of filtering by store_id
?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ServiceStack.OrmLite
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page