ormlite-servicestack

How to define 'geography' type using Npgsql and OrmLite (using postgresql, postgis, c#)

╄→гoц情女王★ 提交于 2019-12-21 12:03:03
问题 How do I define a postgis 'geography' type in my C# class model so that OrmLite can easily pass it through to Postgresql so I can run spatial queries in addition to saving spatial data to the 'geography' column? 回答1: The best library is NetTopologySuite for this case; you can use like this; protected GisSharpBlog.NetTopologySuite.Geometries.Geometry _geom; public GisSharpBlog.NetTopologySuite.Geometries.Geometry Geom { get { return _geom; } set { _geom = value; } } protected string _geomwkt;

Timeout expired. - Using Db in ServiceStack Service

◇◆丶佛笑我妖孽 提交于 2019-12-21 04:59:16
问题 I'm using the Db property in a ServiceStack service to access my database but every now and then I get the following error from IIS: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached. Stack Trace: [InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled

Paging in servicestack ormlite

别来无恙 提交于 2019-12-20 19:12:08
问题 I am looking for a good way to implement paging in ormlite and I found another question, which has this snippet: var data = db.Select<address>(predicate).Skip((int) pageNumber).Take((int) pageSize).ToList(); Problem with the above is that it gets back all the results and then does the skip and take on it which defeats the purpose of paging. At another google groups post I have found the same problem and a sample in a github issue is mentioned as a solution but the URL no longer works. Does

How to unit test ServiceStack?

北战南征 提交于 2019-12-20 18:44:32
问题 I love SS but I'm scratching my head trying to unit test my business layer. I'm new to unit testing andmocking and been reading up on NSubstitute as this looks like a fun mocking layer. I have my file structure roughly like this: MainAppHostProject* | -AppStart -AppHost <-- standard apphost DtoProject* | -HelloWorldDto <-- simple POCO to ServiceLayerProject* | -HelloWorldService <-- service interface that merely passes/sends Dtos to/from business layer BusinessLayerProject* |

Transition from Entityspaces(Tiraggo) into Servicestack Ormlite

风格不统一 提交于 2019-12-20 04:22:09
问题 at this moment we are migrating from Entityspaces(Tiraggo) into Servicestack Ormlite. One point is the way to open and close the DBConnection. I apologize for the comparission but it is useful for the question. In Tiraggo, inside my wep application, in the global.asax.cs I put this: protected void Application_Start(object sender, EventArgs e) { Tiraggo.Interfaces.tgProviderFactory.Factory = new Tiraggo.Loader.tgDataProviderFactory(); } In web.config exists the section for Tiraggo, the

Add property to POCO class at runtime

一个人想着一个人 提交于 2019-12-18 05:56:34
问题 I selected ServiceStack OrmLite for my project which is a pure Data-Oriented application. I am willing to allow the end user to create his own Object Types defined in an XML format that will be used to generate classes at runtime using CodeDOM. I will be also defining some "system" objects required by the application (i.e. User ) but I cannot foresee all the properties the end user will use and therefore I am looking for a way to allow extending the classes I create in design time. Sample

How to register multiple IDbConnectionFactory instances using Funq in ServiceStack.net part 2

♀尐吖头ヾ 提交于 2019-12-18 05:27:12
问题 ServiceStack has delivered on EVERYTHING I've thrown at it, except the SAAS (Multi-tenant) use case where single API instance is using several databases of the same schema, one per tenant. These databases, because of legal reasons need to be housed in separate instances. So, my question is this, "Is it possible to change the connection per Request based on meta from a filter? My question is somewhat similar to this one, but with the added twist that each database is the same. Thank you,

Servicestack with Autofac not resolving IRequestContext

旧巷老猫 提交于 2019-12-13 17:17:29
问题 I am trying to use the Cache facilities of Service Stack. These are accessed through the RequestContext, which is injected by the IOC in your Service. This works as expected if you are using the default Funq IOC, it does not work when you hook AutoFac, RequestContext is null and I am not sure how to configure autofac to build it. Any clues here? My AutoFac configuration: var builder = new ContainerBuilder(); //Now register all dependencies to your custom IoC container builder

UpdateNonDefaults is ignoring boolean parameters set to false

大兔子大兔子 提交于 2019-12-13 12:28:44
问题 I'm trying to update a record in my SQL server 2012 Express DB using UpdateNonDefaults. Boolean fields which are set to false are getting ignored as can be seen from the SQL statement. How can I set DB value to false for boolean fields using UpdateNonDefaults? Thanks in advance.. 回答1: Please post your code, or we can't tell what is wrong... Try: [Default(typeof(bool?), null)] public bool? Foo {get;set;} Or try : [Default(typeof(int?), null)] public int? Foo {get; set;} See if it works? 回答2:

ServiceStack Ormlite - Joins on child classes

瘦欲@ 提交于 2019-12-13 08:10:01
问题 I'm using the latest ServiceStack Ormlite (v4.0.23), which provides new join support for joining on multiple columns. My entities all inherit from a BaseEntity: public class BaseEntity : IBaseEntity { [AutoIncrement] [PrimaryKey] public long Id { get; set; } public DateTime Created { get; set; } public DateTime Updated { get; set; } public DateTime? Deleted { get; set; } public bool IsDeleted { get; set; } } Say I have 2 entities, UserEntity and AnswerEntity, which inherit from this base