fluent-nhibernate

Does Fluent-NHibernate support mapping to procedures?

点点圈 提交于 2019-12-03 06:32:40
I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects. Also is Fluent-NHibernate able to directly execute procedures with no result set returned? Basically I've been considering the implications of using Fluent-NHibernate to replace a dated TypedDataSet model with a domain driven design that can return simple objects from the DAL. If Fluent-NHibernate cannot work with SPs easily, I think I would most likley have a combinational DAL that will take advantage of FNH for

Quoting column names with NHibernate and PostgreSQL

安稳与你 提交于 2019-12-03 06:31:55
I have started to use NHibernate 3.0 and PostgreSQL for a small project, so far the ride has been a little rough due to the NHibernate site being down and I'm sure this answer is on their website somewhere. I have a database that has these two columns(of course there is more in the real table): int ID String Feature now I'm using a FluentNHibernate to do the mapping so something like this: public class MyEntityMap: ClassMap<MyEntity> { public MyEntityMap() { Id(x => x.ID); Map(x => x.Feature); } } and a LINQ query to get out the data var strucs = from str in session.Query<MyEntity>() where str

NHibernate mapping with a class hierarchy whose base class is abstract and the discriminator is not a string

廉价感情. 提交于 2019-12-03 06:25:13
Here are the domain model classes: public abstract class BaseClass { ... } public class ChildClass : BaseClass { ... } Note that the parent class is abstract and this is what gives me some difficulties when comes the time to map with fluent nhibernate. My discriminator is a byte (tinyint in the DB). Because it is not a string and I can't manage to set a discriminator value on the base class, this does not work (taken from the mapping class for BaseClass): DiscriminateSubClassesOnColumn<byte>("Type") .SubClass<ChildClass>() .IsIdentifiedBy((byte)OperationType.Plan) .MapSubClassColumns(p => { ..

many-to-one with multiple columns

99封情书 提交于 2019-12-03 06:20:24
I have a legacy data base and a relation one-to-one between two tables. The thing is that relation uses two columns, not one. Is there some way to say in nhibernate that when getting a referenced entity it used two columns in join statement, not one? I have a similar table structure TaskProgress ProgressId TaskId AssignmentId UserId Tasks TaskId AssignmentId TaskName Each task can be asigned in different assignments. That mean that unique task for task progress can be founded only by AssignmentId and TaskId fields. I'm trying to use this: References(x => x.Template) .Columns() .PropertyRef()

Named query not known error trying to call a stored proc using Fluent NHibernate

两盒软妹~` 提交于 2019-12-03 06:08:15
问题 I'm working on setting up NHibernate for a project and I have a few queries that, due to their complexity, we will be leaving as stored procedures. I'd like to be able to use NHibernate to call the sprocs, but have run into an error I can't figure out. Since I'm using Fluent NHibernate I'm using mixed mode mapping as recommended here. However, when I run the app I get a "Named query not known: AccountsGetSingle" exception and I can't figure out why. I think I might have a problem with my HBM

How to store a non truncated varchar(max) string with NHibernate and Fluent NHibernate

半世苍凉 提交于 2019-12-03 05:54:41
My DB schema has a string as a varchar(max). I have read the other questions concerning setting Length to more than 4000 or 8000 so that it really generates a (n)varchar(max) in the mapping but when I use Length(10000) in my mapping class, the hbm file actually shows length="10000" and if I save an entity with more than 10000 chars, it is actually truncated to exactly 10000 chars. I don't want any truncation. (using NH3-alpha2 and FNH trunk) It would appear that this is an old problem which is now resurfacing in NHibernate 3.x builds; you can read about the workarounds here . Note : I have

NHibernate or Fluent NHibernate? [closed]

旧时模样 提交于 2019-12-03 05:35:41
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I would be interested in hearing op opinions from others regarding whether which they would choose (no 'neithers' please ;), and why.

Fluent NHibernate + Lucene Search (NHibernate.Search)

依然范特西╮ 提交于 2019-12-03 05:25:57
问题 I'm using Fluent NHibernate and I would like to implement NHibernate.Search with Lucene but I can't find any examples on how to do that with Fluent NHibernate. It appears there are two steps. (According to Castle) Set the Hibernate properties in the configuration: hibernate.search.default.directory_provider hibernate.search.default.indexBase hibernate.search.analyzer Initializing the Event Listeners to index persisted objcts configuration.SetListener(ListenerType.PostUpdate, new

NHibernate -failed to lazily initialize a collection of role

蓝咒 提交于 2019-12-03 04:50:18
I have the following seemingly simple scenario, however I'm still pretty new to NHibernate. When trying to load the following model for an Edit action on my Controller: Controller's Edit Action: public ActionResult Edit(Guid id) { return View(_repository.GetById(id)); } Repository: public SomeModel GetById(Guid id) { using (ISession session = NHibernateSessionManager.Instance.GetSession()) return session.Get<SomeModel >(id); } Model: public class SomeModel { public virtual string Content { get; set; } public virtual IList<SomeOtherModel> SomeOtherModel { get; set; } } I get the following error

Problem with linq query

混江龙づ霸主 提交于 2019-12-03 04:20:22
I'm trying to use linq to NHibernate (with Fluent NHibernate) but I have problems with linq query. Everytime I try to execute it I get this message : " Method 'get_IsReadOnlyInitialized' in type 'NHibernate.Linq.Util.DetachedCriteriaAdapter' from assembly 'NHibernate.Linq, Version=1.1.0.1001, Culture=neutral, PublicKeyToken=null' does not have an implementation. " Does anybody know how to fix this problem? I tried with solution form this page with model context but it didn't help. This is the code: using(var session = NHibernateHelper.OpenSession()) { var informations = (from i in session