fluent-nhibernate

Flunet Nhibernate all-delete-orphan not working like expected

白昼怎懂夜的黑 提交于 2020-01-06 10:41:52
问题 I have following domain classes: public class News: EntityBase { public virtual DateTime CreationDate { get; set; } public virtual IList<DomainNameToNews> DomainNameToNews { get; set; } public News() { DomainNameToNews=new List<DomainNameToNews>(); } } public class DomainNameToNews : EntityBase { public virtual DomainName DomainName { get; set; } public virtual News News { get; set; } } Mapping: public class NewsMap : ClassMap<News> { public NewsMap() { Id(x => x.Id).GeneratedBy.Identity();

NHibernate component with a one-to-many relation from parent

这一生的挚爱 提交于 2020-01-06 09:30:09
问题 Say I have a Queue table and a Job table. In the Job table there is a foreign key column QueueId for the Queue table, i.e. Queue.Id <-- Job.QueueId Using Fluent NHibernate it is pretty straightforward to map this to a property in the Queue class, i.e. /* QueueMap */ HasMany(x => x.Jobs) .KeyColumnNames.Add("QueueId"); But assume I have a very good reason to have a class inbetween, say something like: public class Queue { public Group Group { get; set; } } public class Group { public IList<Job

NHibernate component with a one-to-many relation from parent

£可爱£侵袭症+ 提交于 2020-01-06 09:30:09
问题 Say I have a Queue table and a Job table. In the Job table there is a foreign key column QueueId for the Queue table, i.e. Queue.Id <-- Job.QueueId Using Fluent NHibernate it is pretty straightforward to map this to a property in the Queue class, i.e. /* QueueMap */ HasMany(x => x.Jobs) .KeyColumnNames.Add("QueueId"); But assume I have a very good reason to have a class inbetween, say something like: public class Queue { public Group Group { get; set; } } public class Group { public IList<Job

Fluent NHibernate - override type for one specific property on one specific class?

人走茶凉 提交于 2020-01-06 05:49:09
问题 I have a class that has a password property that I want to store encrypted in the db. The property is a string type, and I have a custom type EncryptedStringType that I want NHibernate to use to map this to the database. Here is my relevant automapping code: var mappings = AutoMap.AssemblyOf<Business>() .Where(x=>x.IsSubclassOf(typeof(EntityBase))) .IgnoreBase(typeof(EntityBase)) .Conventions.Add ( ConventionBuilder.Id.Always(x => x.GeneratedBy.HiLo(HILO_TABLE, HILO_COLUMN, HILO_MAX_LO)),

How to map this Dictionary with the newest fluentNHibernate version?

社会主义新天地 提交于 2020-01-06 04:51:06
问题 i've got one more question. I upgraded to FluentNHibernate and got now a problem with my dicitionary mappings. The class i'am trying to map has the following Property IDictionary LohnParameter The mapping is as follows HasMany(x => x.LohnParameter) .ForeignKey("cat_condition_version__id") .DictionaryKey("wrd_cntry__id") .OneToMany<boLohnartEigenschaften>() .Not.Lazy() .Inverse() .Cascade.AllDeleteOrphan(); The resulting hbm.xml looks like this: <map cascade="all-delete-orphan" inverse="true"

Fluent CRUD with NHibernate ASP.NET MVC

最后都变了- 提交于 2020-01-05 21:16:36
问题 ASP.NET MVC makes it really easy to create editing templates for simple, flat objects. But managing CRUD for complex objects with several indirections when using something like Fluent NHibernate, is not so obvious. Example To illustrate my question with a simple Invoice manager, Invoice entities have a Project property: public class Invoice { ... Project Project { get; set; } // where Project class has an Id and a Name } ...which is mapped to the Projects table via Fluent NHibernate in my

Fluent CRUD with NHibernate ASP.NET MVC

爱⌒轻易说出口 提交于 2020-01-05 21:12:53
问题 ASP.NET MVC makes it really easy to create editing templates for simple, flat objects. But managing CRUD for complex objects with several indirections when using something like Fluent NHibernate, is not so obvious. Example To illustrate my question with a simple Invoice manager, Invoice entities have a Project property: public class Invoice { ... Project Project { get; set; } // where Project class has an Id and a Name } ...which is mapped to the Projects table via Fluent NHibernate in my

Fluent CRUD with NHibernate ASP.NET MVC

核能气质少年 提交于 2020-01-05 21:12:35
问题 ASP.NET MVC makes it really easy to create editing templates for simple, flat objects. But managing CRUD for complex objects with several indirections when using something like Fluent NHibernate, is not so obvious. Example To illustrate my question with a simple Invoice manager, Invoice entities have a Project property: public class Invoice { ... Project Project { get; set; } // where Project class has an Id and a Name } ...which is mapped to the Projects table via Fluent NHibernate in my

Automapping a Composite Model with Composite Iteration with FluentNhibernate

怎甘沉沦 提交于 2020-01-05 12:06:10
问题 I have a tree structured model and designed it with composite Pattern. for iterating through the entire hierachy Im using Composite Iteration. I have used this tutorial: http://www.blackwasp.co.uk/Composite.aspx but when I want to AutoMap the model, I encounter this problem: {"The entity '<GetEnumerator>d__0' doesn't have an Id mapped. Use the Id method to map your identity property. For example: Id(x => x.Id)."} but getEnumerator is a method. I don't know why handle this like an Entity!!

fluent NHibernate: many-to-many relationship with Product to Product

为君一笑 提交于 2020-01-05 10:18:07
问题 fluent NHibernate: many-to-many relationship with Product to Product.how i can implement it on asp.net mvc public class Product { public virtual int Id { get; set; } public virtual IList<Product> ManyProduct { get; set; } } Mapping public class ProductMap : ClassMap<Product> { public ProductMap() { Id(x => x.Id); Map(x => x.ImageUrl); } HasManyToMany(x => x.ManyProduct) .Cascade.All() .Table("ProductInProduct"); } 回答1: You don't specifically say what is wrong but your HasManyToMany definition