fluent-nhibernate

Fluent-Nibernate with wpf: Convention to use uNhAddIns…ObservableListType<T> as default?

不羁的心 提交于 2020-02-03 10:00:08
问题 I am trying to use Fluent-Nibernate with wpf that require Observable collections (implement the INotifyCollectionChanged interface). At uNHAddins: Unofficial addins for NHibernate i found the uNhAddIns.WPF.Collections.Types.ObservableListType<T> that implements INotifyCollectionChanged . It can be configured in Fluent-Nibernate like this namespace FluentNHibernateTutorial.Mappings { public class StoreMap : ClassMap<Store> { public StoreMap() { Id(x => x.Id); Map(x => x.Name); HasManyToMany(x

Why does Fluent NHibernate AutoMappings add an underscore to Id (e.g. Entity_id)?

扶醉桌前 提交于 2020-01-30 06:41:44
问题 Hi using fluent nibernate automappings to map this public virtual int Id { get; set; } /*...snip..*/ public virtual MapMarkerIcon MapMarkerIcon { get; set; } } to this CREATE TABLE [Attraction]( [Id] [int] IDENTITY(1,1) NOT NULL, [MapMarkerIconId] [int] NULL ) with this: var cfg = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString) .DefaultSchema("xxx")) .Mappings(m => { m.AutoMappings .Add( AutoMap.AssemblyOf<Partner>().Where( n => n.Namespace ==

Generate table indexes using Fluent NHibernate

血红的双手。 提交于 2020-01-28 17:59:44
问题 Is it possible to generate table indexes along with the rest of the database schema with Fluent NHibernate? I would like to be able to generate the complete database DDL via an automated build process. 回答1: In more recent versions of Fluent NHibernate, you can call the Index() method to do this rather than using SetAttribute (which no longer exists): Map(x => x.Prop1).Index("idx__Prop1"); 回答2: Do you mean indexes on columns? You can do it manually in your ClassMap<...> files by appending

Fluent Nhibernate map list of lists

佐手、 提交于 2020-01-25 11:33:08
问题 I am writing mapping for the class with Fluent Nhibernate: public class UniqueFeaturesSet : IEntity { public UniqueFeaturesSet(List<List<double>> mfcc) { MFCC = mfcc; } public virtual List<List<double>> MFCC { get; set; } public virtual int Id { get; set; } } How to map List<List<double>> ? 回答1: It is not possible to map nested collections with [Fluent][N]Hibernate. The inner collection needs to be in an own class. 来源: https://stackoverflow.com/questions/10872334/fluent-nhibernate-map-list-of

Fluent Nhibernate map list of lists

扶醉桌前 提交于 2020-01-25 11:33:06
问题 I am writing mapping for the class with Fluent Nhibernate: public class UniqueFeaturesSet : IEntity { public UniqueFeaturesSet(List<List<double>> mfcc) { MFCC = mfcc; } public virtual List<List<double>> MFCC { get; set; } public virtual int Id { get; set; } } How to map List<List<double>> ? 回答1: It is not possible to map nested collections with [Fluent][N]Hibernate. The inner collection needs to be in an own class. 来源: https://stackoverflow.com/questions/10872334/fluent-nhibernate-map-list-of

Error using NHibernate

蓝咒 提交于 2020-01-24 17:47:07
问题 Considering this example as a base example. I created the application but when I execute this application getting the following error. The ProxyFactoryFactory was not configured. Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers. Example: NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu Example: NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle

NHibernate explicit fluent column mapping

我们两清 提交于 2020-01-23 13:18:25
问题 I have a set of fluent object mappings that looks like this: public class UserMap : ClassMap<User> { public UserMap() { Map(x => x.Id); Map(x => x.Status); } } public class SpecialUserMap : SubClassMap<SpecialUser> { public SpecialUserMap() { Map(x => x.Property); } } public class DirectoryMap : ClassMap<Directory> { public DirectoryMap { Map(x => x.Id); HasMany(x => x.SpecialUsers).Where("Status = 0"); } } User is a join table, which SpecialUser joins against to get things like status.

NHibernate explicit fluent column mapping

六眼飞鱼酱① 提交于 2020-01-23 13:18:09
问题 I have a set of fluent object mappings that looks like this: public class UserMap : ClassMap<User> { public UserMap() { Map(x => x.Id); Map(x => x.Status); } } public class SpecialUserMap : SubClassMap<SpecialUser> { public SpecialUserMap() { Map(x => x.Property); } } public class DirectoryMap : ClassMap<Directory> { public DirectoryMap { Map(x => x.Id); HasMany(x => x.SpecialUsers).Where("Status = 0"); } } User is a join table, which SpecialUser joins against to get things like status.

Lazy loading for NHibernate with Ignore.NotFound

蹲街弑〆低调 提交于 2020-01-22 19:54:39
问题 I have a mapping like the bellow for a Candidate object: References(x => x.Country).Column("CountryId").NotFound().Ignore() the problem here is, if I select * Candidates I get a extra select for each of them, not a good thing, so I pull out the NotFound().Ignore() bit but now the following code fails with ObjectNotFoundException exception: if (entity.Country != null) { bos.CountryName = entity.Country.Name; } Is there a way to force Hhibernate do the select when I compare County != null ?

NHibernate many-to-many assocations making both ends as a parent by using a relationship entity in the Domain Model

泄露秘密 提交于 2020-01-22 16:56:09
问题 Entities: Team <-> TeamEmployee <-> Employee Requirements: A Team and an Employee can exist without its counterpart. In the Team-TeamEmployee relation the Team is responsible (parent) [using later a TeamRepository]. In the Employee-TeamEmployee relation the Employee is responsible (parent) [using later an EmployeeRepository]. Duplicates are not allowed. Deleting a Team deletes all Employees in the Team, if the Employee is not in another Team. Deleting an Employee deletes only a Team, if the