nhibernate-mapping

Path Location:Oracle.Driver (Oracle.DataAccess.dll) for Oracle 11g Standard Edition Release 2

。_饼干妹妹 提交于 2019-12-24 00:34:04
问题 I have installed Oracle 11g Standard Edition Release 2. I am working with nhibernate 2.2. I already spent lots of time but I could not find the location of Oracle Driver dll file (Oracle.DataAccess.dll) in the installed file.Please Help me. Thanks in advance. Satadip 回答1: Since 11.2 Oracle Data Provider for .NET ships with two sets of binaries The Oracle.DataAccess.dll assembly is installed to the following locations: .NET Framework 2.0: ORACLE_BASE\ORACLE_HOME\odp.net\bin\2.x directory .NET

How do I get NHibernate to save an entity if I assign it an ID, but generate one otherwise?

半城伤御伤魂 提交于 2019-12-23 23:09:04
问题 According to the REST philosophy, a PUT request should update the resource at a URL if it exists, and create it if it doesn't exist. So in other words, if I use the following URL: PUT http://server/item/5 If an Item exists with an ID of 5, it will be updated. If an Item doesn't exist with an ID of 5, a new Item will be created with an ID of 5. However, I'm using NHibernate for persistence, and I mapped my IDs as Identity . This means that no matter what value I assign the ID, NHibernate will

entity -> interface relationship, how to map

十年热恋 提交于 2019-12-23 17:23:28
问题 I’m trying to develop some basic web app. I will post question with only two entities Article and Image. One article has many images, and one or more images belong to only one article. Every article implements interface IArticle and abstract class ArticleBase. ArticleBase defines only common properties for each article but child articles can have more properties beside those defined in ArticleBase. So I have ( IArticle , ArticleBase , ArticleComputer , ArticleCar ) public abstract class

one of the fields is count(*) NHibernate

大兔子大兔子 提交于 2019-12-23 16:32:54
问题 Can I do mapping to query like this : select id,name,address,(select count(*) from account where record_id=id ) as counter from data where id = :id Currently , I'm using a native SQL . class person { public virtual long Id{get;set;} public virtual string Name{get;set;} public virtual string Address{get;set;} public virtual long Counter{get;set;} } mapping : <property name="Counter" formula="(select count(*) from account where record_id=id )" type="long"/> 回答1: Yes, you should use formula.

one of the fields is count(*) NHibernate

我的未来我决定 提交于 2019-12-23 16:32:34
问题 Can I do mapping to query like this : select id,name,address,(select count(*) from account where record_id=id ) as counter from data where id = :id Currently , I'm using a native SQL . class person { public virtual long Id{get;set;} public virtual string Name{get;set;} public virtual string Address{get;set;} public virtual long Counter{get;set;} } mapping : <property name="Counter" formula="(select count(*) from account where record_id=id )" type="long"/> 回答1: Yes, you should use formula.

How can I create a Fluent NHibernate Convention that ignores properties that don't have setters

孤街浪徒 提交于 2019-12-23 15:24:06
问题 I'm looking for a FluentNH (Fluent NHibernate) convention or configuration that ignores all properties that have no setter: It would still map these: public class foo{ public virtual int bar {get; private set;} } And omit these: public class foo{ public virtual int fizz{get;private set;} public virtual int bar{get {return fizz;}} //<------- } 回答1: You should use a custom mapping configuration public class DefaultMappingConfiguration : DefaultAutomappingConfiguration { public override bool

Could not find the property - exception after switching from NHibernate 3 to 3.3.1

跟風遠走 提交于 2019-12-23 12:08:07
问题 I have a class with a field: protected DateTime insertDate; This is mapping for this fiels: <property name="InsertDate" access="field.camelcase" update="false" /> This field is set when with ctor public DocuBase(DateTime insertDate) and is persisted only when row is added to the database. I don't need property for it at all, no setter & no getter. I worked in NHibernate 3. And now, I've moved from NHiberbate 3 to NHibernate 3.3.1, and I get this exception when session factory is created:

Fluent nHibernate Join is doing insert into joined table

℡╲_俬逩灬. 提交于 2019-12-23 09:51:08
问题 I am trying to use join to pull in a single property from another table, which doesn't have a mapping. My problem is that when I create a new instance of my mapped entity and save it I get an error about trying to insert into my unmapped table (it's trying to insert null into a not null column). I thought using .ReadOnly() would stop nhibernate from trying to insert into my unmapped table but that doesn't seem to work. My mapping looks like this: // Join _UnMapped table with Mapped table to

Mapping large string with Fluent NHibernate

痞子三分冷 提交于 2019-12-23 09:27:54
问题 I'm working with an Oracle DB, and I'm trying to map this class: public class Book { public virtual int Id { get; private set; } public virtual string Author { get; set; } public virtual string Title { get; set; } public virtual string Text { get; set; } } With this mapping class: public class BookMap : ClassMap<Book> { public BookMap() { Id(x => x.Id); Map(x => x.Author); Map(x => x.Title); Map(x => x.Text); } } But the column type that it generates me is NVARCHAR(255), And the Book.Text

How do you make NHibernate ignore a property in a POCO

浪子不回头ぞ 提交于 2019-12-23 07:06:08
问题 We have POCO, something like: public class Person { public Guid PersonID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public DateTime DateOfBirth { get; set; } public string Version {get; set; } } And the corresponding hbm file as <?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="NHibernate.FirstAttempt" namespace="NHibernate.FirstAttempt.Entity" > <class name="Person" lazy="false"> <id name=