fluent-nhibernate

How to use ObservableCollection with Fluent nHibernate?

£可爱£侵袭症+ 提交于 2019-12-10 18:59:15
问题 ObservableCollection<ItemPedido> Items But now in Fluent nHibernate i don´t know how to use it. Is there an easy way to use ObservableCollection with Fluent nHibernate? I noticed there is a DLL NHibernate.Collection.Observable; But i don´t know how to replace my current code that uses IList: public virtual IList<ItemPedido> Items { get { return _Items; } set { _Items = value; OnPropertyChanged(System.Reflection.MethodBase.GetCurrentMethod().Name.Substring(4)); /*OnPropertyChanged("Items");*/

Setting Linq to NHibernate ADO Command Timeout

一个人想着一个人 提交于 2019-12-10 18:54:54
问题 How do I increase the timeout in NHibernate Linq To Sql? Not the Connection Timeout but the ado command timeout. using (ISession session = NHibernateHelper.OpenSession(NHibernateHelper.Databases.CarrierCDR)) using (session.BeginTransaction(IsolationLevel.ReadUncommitted)) { lCdrs = (from verizon in session.Linq<Domain.Verizon>() where verizon.Research == true && verizon.ReferenceTable == null orderby verizon.CallBillingDate descending select verizon).ToList(); } 回答1: if you are configuring

WrongClassException when trying to implement Strategy Pattern (discriminating on own Id)

╄→尐↘猪︶ㄣ 提交于 2019-12-10 18:52:40
问题 I'm trying to implement the Strategy Pattern with Fluent Nhibernate, inspired by this blog post public abstract class Strategy { protected Strategy() { } protected Strategy(Guid id) { this.Id = id; } public virtual Guid Id { get; set; } public abstract void SomeMethod(); } public class MyStrategy : Strategy { public MyStrategy() : base(new Guid("F1CF041B ...")) { } public override void SomeMethod() { } } public class StrategyMap : ClassMap<Strategy> { public StrategyMap() { this.Id(x => x.Id)

Mapping clobs using Fluent NHibernate, Oracle 10g and OracleClientConfiguration.Oracle10

随声附和 提交于 2019-12-10 18:44:24
问题 I've been trying to map a clob field using Fluent NHibernate 1.2.0.712 against Oracle 10g. I'm using System.Data provider as it's available by default and was trying to avoid adding reference to ODP.Net due to previous client issues. However, when I try to insert entities with mapped clob properties, I get the error: ORA-01461: can bind a LONG value only for insert into a LONG column I've tried to fix this by using the below convention, and decorating the appropriate property with

NHibernate: Cascading saves to children does not insert

烈酒焚心 提交于 2019-12-10 18:20:10
问题 I have a bidirectional association like this: public class Parent { public int ParentId {get; set;} ...other properties public IEnumerable<Child> Children {get; set;} } public class Child { public int ChildId {get; set;} ...other properties public Parent Parent {get; set;} } The fluent mappings are as follows: Parent mapping Id(x => x.ParentId, "PARENT_ID").GeneratedBy.Identity(); .. other mappings HasMany(x => x.Children).Cascade.All().KeyColumn("PARENT_ID"); Child mapping Id(x => x.ChildId,

Fluent NHibernate automap PostGIS geometry type

巧了我就是萌 提交于 2019-12-10 17:48:14
问题 Given the following model: using NetTopologySuite.Geometries; public class bounding_box { public virtual int id { get; protected set; } public virtual Polygon area { get; set; } } How do I automap the area property to a area geometry(Polygon) column when generating the DB schema using Fluent Nhibernate? Note that I do not care about being able to read / update the geometry column using NHibernate since I will be using GDAL in my code. I know I can do it by implementing a manual override, i.e.

Nhibernate n+1 with ternary relationship. Want the middle entity in the ternary

混江龙づ霸主 提交于 2019-12-10 17:40:34
问题 I'm having a huge issue with nhibernate n+1 and nothing I try seems to fix the problem. Nhibernate profiler still shows n+1 selects hitting the database. Here's my model: public class CustomerGroup : CoreObjectBase { public virtual long GroupId { get; set; } public virtual Site Site { get; set; } public virtual IList<Customer> Customers { get; set; } public virtual string Name { get; set; } public virtual string DisplayName { get; set; } public virtual CustomerGroupStatus Status { get; set; }

Fluent NHibernate and XML columns

流过昼夜 提交于 2019-12-10 17:16:26
问题 I'm building a new site from scratch and am considering using Fluent NHibernate for my ORM. I think it'll handle everything easily except, possibly, my XML columns. I've never built a site with NHibernate at all (though I've used Hibernate for Java) so consider me a n00b. Ideally I'd like the XML to be treated as an XElement as Linq-to-SQL does. Can I do this with (fluent) NHibernate? What if I want to use auto mapping? 回答1: You can use the IUserType defined here: https://nhibernate.jira.com

property filter with fluent nHibernate automapping

可紊 提交于 2019-12-10 16:55:58
问题 i'm trying to create a filter, using fluent nH (1.2) automapping with nH 2.1.2. I've followed the example here, but I keep getting the exception: filter-def for filter named 'DateFilter' was never used to filter classes nor collections.. the filter class: public class DateFilter : FilterDefinition { public DateFilter() { WithName(Consts.FilterConsts.DATE_FILTER) .AddParameter("date", NHibernate.NHibernateUtil.DateTime) .WithCondition("DATEPART(dayofyear,EntityTime) = DATEPART(dayofyear, :date

NH3.2 Mapping By Code using 'where' clause

寵の児 提交于 2019-12-10 16:39:34
问题 I've tried to define many-to-many relation with 'where' clause using MappingByCode from NH3.2 , but I don't know how can I do it. With FluentNHibernate I can use the ChildWhere() method: public class ProcedureMap : ClassMap<Procedure> { public ProcedureMap() { this.HasManyToMany(a => a.FormTemplates).ChildWhere("IsDeleted = 0").AsSet(); } } This code will generate next HBM: <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class xmlns="urn:nhibernate-mapping-2.2" name="Procedure" table=