fluent-nhibernate

Npgsql - Specified method is not supported

霸气de小男生 提交于 2019-12-12 23:01:22
问题 This might be somehow connected to this other issue I had with FNH. Fluent NHibernate cannot load MySql.Data from GAC in debug mode of a test Generally I got a simple test that runs following code first: FluentConfiguration config = Fluently .Configure() .Database( PostgreSQLConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("PostgreSQLConnectionString"))) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyMapping>()); s_SessionSource = new SessionSource(config); When

In Fluent NHibernate, how do you map a Component list?

给你一囗甜甜゛ 提交于 2019-12-12 19:58:48
问题 how do you map a Component list in Nhibernate fluently? public class Registration : Entity { public virtual IList<InsuranceInformation> InsuranceInformation { get; set; } } public class InsuranceInformation { public virtual Person Insured { get; set; } public virtual string PolicyNumber { get; set; } public virtual string InsuranceCompanyId { get; set; } public virtual string InsuranceCompanyName { get; set; } public virtual string PlanType { get; set; } public virtual string GroupNumber {

NHibernate not showing Update queries with ShowSql enabled

▼魔方 西西 提交于 2019-12-12 19:35:42
问题 I am using Visual Studio 2010 with NHibernate 3.1 and using Fluent NHibernate for mapping. It has been working well, and with the ShowSql enabled it shows all the select queries. I have gotten to the portion of the program where I am performing some updates, but they don't show. At first I thought the updates weren't getting triggered even though i was using an explicit transaction - but the data was getting changed in the database. So - somehow, the queries are being executed, but not shown

Can auto mappings conventions work with mapping overrides?

寵の児 提交于 2019-12-12 16:05:48
问题 I have a convention for my ids, which automatically maps properties with a name of Id as the identifier. As requirements are being fleshed out I need to tweak a domain model so naturally I went online and found that I need to create a class that inherits from IAutoMappingOverride<T> . My convention: public class PrimaryKeyConvention : IIdConvention, IIdConventionAcceptance { public void Apply(IIdentityInstance instance) { instance.Column("Id"); instance.GeneratedBy.SeqHiLo(instance.Name, "10"

NHibernate When to Use lazy loading? [closed]

こ雲淡風輕ζ 提交于 2019-12-12 15:56:26
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . All I understand about lazy loading is that it loads only when the object is needed and we should use it. Please explain me which scenarios we have to use and not use it? Thanks in advance. 回答1: I would put it this way: Lazy loading is the essence of ORM. It is the principle of

Map generic EntityBase<TEntity> class with FluentNHibernate

我怕爱的太早我们不能终老 提交于 2019-12-12 15:15:23
问题 I have a base class for all my entity types which is like public abstract class EntityBase<TEntityType> : IEntityBase where TEntityType : EntityBase<TEntityType> { private List<IBusinessRule> _brokenRules = new List<IBusinessRule>(); private int? _hashCode; public int ID { private set; get; } and in my mappings i would like to use table-per-class strategy but how to map this EntityBase class? I tryed public class EntityBaseMap:ClassMap but it doesnt work. So how could i map this class? The

Fluent NHibernate: ManyToMany Self-referencing mapping

那年仲夏 提交于 2019-12-12 15:11:41
问题 I need help in creating the correct fluent nh mapping for this kind of scenario: A category can be a child of one or more categories. Thus, resulting to this entity: public class Category : Entity, IAggregateRoot { [EntitySignature] public virtual string Name { get; set; } public virtual IList<Category> Parents { get; set; } public virtual IList<Category> Children { get; set; } public virtual IList<ProductCategory> Products { get; set; } public Category() { Parents = new List<Category>();

NHibernate 3.2 Object isn't updated during flush when lazy property is used

淺唱寂寞╮ 提交于 2019-12-12 13:44:34
问题 I use lazyload property in my entity. It works correct, but NHibernate doesn't make update when any property in this class is changed via method. If property is changed directly then all is ok. I suppose that problem in that in case of lazy property proxy object is returned and this proxy doesn't handle inner changes. I have added test code below. It works fine in NHibernate 3.1 but update isn't called in NHibernate 3.2 and 3.3 Maybe someone know how to solve this problem? Thanks. Entity: ///

How do I tell Fluent NHibernate to ignore specific properties without automapping?

时光毁灭记忆、已成空白 提交于 2019-12-12 13:42:02
问题 I am using Fluent NHibernate to map out an existing database. For this reason - automapping isn't an option for me. How do I tell NHibernate not to map certain properties? Many of them are read-only, and the others do not need to be persisted for other reasons. I am writing this in VB.Net. I get the typical error message: "The following types may not be used as proxies ... should be 'public/protected virtual' or 'protected internal virtual'" I have purposely not made my objects Overridable

Fluent NHibernate two levels Inheritance Issue

被刻印的时光 ゝ 提交于 2019-12-12 13:17:38
问题 I want to have Table per Type in one level and one Table for hierarchy in another level. Is it possible? description is here -> I have these classes: public class BaseItem { public int Id{ get; set; } } public class Item : BaseItem { } public class Child1 : Item { } public class Child2 : Item { } I wanna have tables for "BaseItem" and "Item" and not for "Child1" and "Child2" I try this mappings: public class BaseItemMap : ClassMap<BaseItem> { public BaseItemMap() { Id(p => p.Id).Column(