fluent-nhibernate

Meaning of 'Disabled ghost property fetching for <entity> because it does not support lazy at the entity level'

扶醉桌前 提交于 2019-12-10 23:30:28
问题 I have seen this warning in my NHibernate-DataAccess: 'Disabled ghost property fetching for entity because it does not support lazy at the entity level' Does someone know, what does this mean? - What does I have to change to solve this? Here is a mapping for an entity, which is causing this warning: public class BusinessTypeMap : ClassMap<BusinessType> { public BusinessTypeMap() { this.Table("BusinessType"); this.Version(x => x.ObjectVersion); this.Id(x => x.Id).GeneratedBy.Assigned(); this

fluent nHibernate map YesNo when column is nullable

青春壹個敷衍的年華 提交于 2019-12-10 22:58:16
问题 I'm using fluent nHibernate to map a a database flag column "Y"/"N" to bool property: Map(x => x.Enabled).Column("ENABLED_FLAG").CustomType("YesNo"); The question is, how would one specify how to map a null? Will the null be mapped to true, false, exception? Update The default settings seems to map NULL to false. I like that, but still wondering how I could override that to be true? 回答1: If you want to change the functionality of the null case you would have to create your own custom type -

NHibernate Table Update Event

点点圈 提交于 2019-12-10 22:57:46
问题 I have this table mapping (details don't really matter I think): WithTable("COPACKER_FACILITY"); Id(x => x.FacilityNumber, "FACILITY_NUM").GeneratedBy.Sequence("FACSEQ"); Map(x => x.FacilityName, "FACILITY_NAME").Not.Nullable().Trimmed(); Map(x => x.AddressLine1, "ADDR1").Not.Nullable().Trimmed(); ... WithTable("FACIL_OTH_AUDIT_INFO", m => { m.WithKeyColumn("FACILITY_NUM"); m.Map(x => x.ProdnShiftsNum, "PRODN_SHIFTS_NUM").Not.Nullable(); m.Map(x => x.ProdnCapacity, "PRODN_CAPACITY").Not

HasManyToMany Fluent NHibernate Mapping Delete Error

北城以北 提交于 2019-12-10 22:37:40
问题 I have been working on a many to many mapping on an entity i have called Task. A task can have many children and many parents. There is a join table in between which just has the two FK columns "ParentTaskId" and "ChildTaskId". Here is what I have come up with so far. // Many-to-Many Parents HasManyToMany<Task>(x => x.Parents) .Table("TaskDependency") .ParentKeyColumn("ParentTaskId") .ChildKeyColumn("ChildTaskId") .Inverse() .Not.LazyLoad() .Cascade.SaveUpdate(); // Many-to-Many Children

How to add extra field in the ManyToMany generated table with FluentNHibernate

不打扰是莪最后的温柔 提交于 2019-12-10 22:28:04
问题 I have 2 entities Users and Colors. One user may be associated with multiple colors, and one color may be associated with multiple users. I use FluentNHibernate autopersistence model to generate the database. Now I have to add to the generated table UserToColor(UserId,ColorId) also an extra field 'CreatedOn', how can I accomplish and is this accomplishable with fluent-nhibernate? 回答1: NHibernate doesn't support this. The best workaround is to create an extra class as a link table, and have a

How do I debug slow NHibernate Select query?

孤者浪人 提交于 2019-12-10 21:29:31
问题 I'm doing a simple query on the database, a search on two columns. I have an index on the columns. When I do the search in SQL Server Management Studio, it takes only a few milliseconds to complete (always less than 10). When I do the same query in NHibernate, it takes over 30 seconds. I've profiled the query, and the generated SQL is fine. I'm using NHibernate Profiler, and when I select "show query results" in NHibernate Profiler, it takes less than a second to get the results. Where do I

Fluent Nhibernate - selecting specific column and count query with group by

安稳与你 提交于 2019-12-10 21:08:09
问题 I'm having some trouble excuting a query in fluent nhibernate. I have a table : Books with the following columns: ID, NAME, YEAR, BOOK_TYPE, AUTHOR_ID I want to excute the following sql query in Fluent NHibernate: SELECT BOOK_TYPE, COUNT(*) FROM BOOKS GROUP BY BOOK_TYPE 回答1: So called Fluent-NHibernate is just a mapping extension. To get data we need NHibernate built n querying features: ICriteria , QueryOver or even a LINQ . Based on the documentation we can use projections for the above

no persister for: Fluent nHibernate Exception

↘锁芯ラ 提交于 2019-12-10 21:04:21
问题 i m getting the exception "No persister for: MVCTemplate.Common.Entities.User" . I Google this issue and apply all the solution i found. but all are useless for me. Does anyone know what i m doing wrong ? my User Class code is public class User { public virtual Guid UserID { get; private set; } public virtual string UserName { get; set; } public virtual string Password { get; set; } public virtual string FullName { get; set; } public virtual string Email { get; set; } public virtual TimeSpan

Commit is VERY slow in my NHibernate / SQLite project

六月ゝ 毕业季﹏ 提交于 2019-12-10 20:55:14
问题 I've just started doing some real-world performance testing on my Fluent NHibernate / SQLite project, and am experiencing some serious delays when when I Commit to the database. By serious, I mean taking 20 - 30 seconds to Commit 30 K of data! This delay seems to get worse as the database grows. When the SQLite DB file is empty, commits happen almost instantly, but when it grows to 10 Meg, I see these huge delays. The database has 16 tables, averaging 10 columns each. One possible problem is

Using Castle ActiveRecord with Fluent NHibernate?

旧时模样 提交于 2019-12-10 19:59:40
问题 Has anyone gotten Fluent NHibernate to work with Castle ActiveRecord? I am particularly interested in Automapping to configure entities for use with the ActiveRecordMediator repository. 回答1: This combo doesn't work yet. When trying to use ActiveRecordMediator on a FluentNHibernate-configured entity you'll get an ActiveRecordException complaining that you didn't call ActiveRecordStarter.Initialize() or you didn't use the [ActiveRecord] attribute. However there is work being done on this