ormlite-servicestack

Servicestack ormlite window functions

余生颓废 提交于 2021-02-11 15:19:43
问题 I am using version 4.5.14 of Servicestack ormlite Following are my domain classes public class Network { [PrimaryKey] public string Id { get; set; } public string Name { get; set; } [CustomSelect("NULL")] public bool? InMaintenance { get; set; } } public class NetworkMain { [PrimaryKey] public string Id { get; set; } [ForeignKey(typeof(Network))] public string NetworkId { get; set; } public DateTime? EndDate { get; set; } } 1 network may have 1 or NetworkMain records. here InMaintenance is

Where contains throw Value can't be null

狂风中的少年 提交于 2020-04-15 22:43:57
问题 I'm stuck and don't know why this issue occurs. Normally we do like this: var q = await OrmDb.SelectAsync<OrmProductSerial>(p => p.SerialNumber.Contains(reqSearch) ); In this case I need do like this, but it throws an error. Doesn't ormlite support this ? ( linq can do it ) var q = await OrmDb.SelectAsync<OrmProductSerial>(p => reqSearch.Contains(p.SerialNumber) ); Thanks. 回答1: Based on this, for ormlite , you need to use Sql.In instead, something like this: OrmDb.SelectAsync<OrmProductSerial

Where contains throw Value can't be null

∥☆過路亽.° 提交于 2020-04-15 22:42:10
问题 I'm stuck and don't know why this issue occurs. Normally we do like this: var q = await OrmDb.SelectAsync<OrmProductSerial>(p => p.SerialNumber.Contains(reqSearch) ); In this case I need do like this, but it throws an error. Doesn't ormlite support this ? ( linq can do it ) var q = await OrmDb.SelectAsync<OrmProductSerial>(p => reqSearch.Contains(p.SerialNumber) ); Thanks. 回答1: Based on this, for ormlite , you need to use Sql.In instead, something like this: OrmDb.SelectAsync<OrmProductSerial

How to set conditions/filters on references when using Load* methods

早过忘川 提交于 2020-01-17 08:14:04
问题 I have two tables: Customer and Orders. The customer has a reference to Orders like such: [Reference] public List<Order> Orders { get; set; } The Order class has an attribute Deleted . I'd like to load all Customers (or a subset), and include the Orders, but not the ones with Deleted=true. Can this be done with LoadSelect methods, or what is the recommended way? Something that would roughly equal the following SQL: select * from Customers C join Orders O on O.CustomerId = C.Id where O.Deleted

ServiceStack Exception: 'Handler for Request not found' when trying to insert Entry to SqlLite db

非 Y 不嫁゛ 提交于 2020-01-16 03:38:48
问题 I'm just learning how to use ServiceStack and I am getting an exception that I can't get past and not sure what is causing the exception. Here it is: Handler for Request not found: Request.ApplicationPath: / Request.CurrentExecutionFilePath: /entry/5/11-11-2012 Request.FilePath: /entry/5/11-11-2012 Request.HttpMethod: GET Request.MapPath('~'): C:\Projects\Tutorials\FirstServiceStackApp\FirstServiceStackApp\ Request.Path: /entry/5/11-11-2012 Request.PathInfo: Request.ResolvedPathInfo: /entry/5

ServiceStack.OrmLite: Where is the method to write custom SQL and get result set back?

不羁岁月 提交于 2020-01-13 20:21:15
问题 I have been reading on https://github.com/ServiceStack/ServiceStack.OrmLite to find methods so I can execute normal SQL (string commands), and get a result set back, but I dont think there is any. I am testing OrmLite v 4.0.17.0. On the page above, there is a method SqlList mentioned, but I have no such method available: I have an ExecuteSql, but I get no result set back, just an int: So, two questions: Is there a way to execute custom queries, a method that takes in a string as parameter,

How can I modify the SQL generated by ServiceStack.OrmLite?

蹲街弑〆低调 提交于 2020-01-05 10:10:57
问题 I want to use ServiceStack's OrmLite in C# to query AWS RedShift. AWS RedShift uses the postgresql wire protocol as its query interface, and puts some constraints on the queries that can be run, one of which is that it cannot accept parameterised queries (I've been told; I haven't actually been able to find this backed up in documentation yet). So, I am investigating whether it would be possible to use an ORM to generate parameterised SQL, then find/replace in the parameter values. How can I

What is happening in debug compilation that is causing the query to take longer to execute?

ぃ、小莉子 提交于 2020-01-05 09:37:49
问题 ServiceStack 3.9.69 via Nuget using SqlServer OrmLite dialect I'm attempting to execute a parameterized stored procedure but am noticing an unusual slowness when the compilation mode is set to debug . The method that is slow is ConvertToList below: Dim result = Db.Exec(Of List(Of Dto.FieldSample))( Function(cmd) cmd.CommandType = CommandType.StoredProcedure cmd.CommandText = "up_GetFieldSample" cmd.Parameters.Add(New SqlClient.SqlParameter("@uploadID", uploadId)) Dim reader = cmd

ServiceStack ORMLite Cannot Update Identity Column

余生长醉 提交于 2020-01-05 05:47:12
问题 I am using ServiceStack ORMLite to try and update a record in my database. All of my POCO's implement an IHasID interface public interface IHasId { int Id { get; set; } } In my POCO I have the following property private int id; [ServiceStack.DataAnnotations.Alias("TableName_ID")] public int Id { get { return id; } set { if (value != this.id) { this.id = value; NotifyPropertyChanged("Id"); } } } Each of my repository classes inherits a from a DataRepositoryBase< T> class that has the following

AutoQuery / Ormlite-servicestack: Can I filter out soft deletes on a QueryDb class?

一曲冷凌霜 提交于 2020-01-05 03:56:11
问题 We have a few services built up with Ormlite/Servicestack and we are mostly pulling out database objects and POCOs using QueryData with custom logic. However, we have one table that really doesn't need to be logically expanded on and works just fine querying the DB directly from the front end using AutoQuery and URL params. However, this table contains an isDeleted column to track soft deletes. The front end should not have any soft-deleted items, and we believe the front end shouldn't be