nhibernate

Fluent NHibernate Inheritance mapping type

£可爱£侵袭症+ 提交于 2020-01-03 01:58:07
问题 I'm new to Fluent NHibernate, thus far I managed to get my mapping working except for the inheritance part. Is there anybody who could help me finish the mapping? I have simplified the code as much as possible. Thank you! My database: CREATE TABLE [User] ( UserID INT NOT NULL IDENTITY(1,1), Type CHAR(1) NOT NULL, Email VARCHAR(255) NOT NULL, PRIMARY KEY(UserID) ); CREATE TABLE [Student] ( UserID INT NOT NULL, Firstname VARCHAR(255) NOT NULL, PRIMARY KEY(UserID), FOREIGN KEY(UserID) REFERENCES

FluentNHibernate: How to translate HasMany(x => x.Addresses).KeyColumn(“PersonId”) into automapping

偶尔善良 提交于 2020-01-03 01:43:26
问题 Say I have these models: public class Person { public virtual int Id { get; private set; } public virtual ICollection<Address> Addresses { get; private set; } } public class Address { public virtual int Id { get; private set; } public virtual Person Person { get; set; } } I want FluentNHibernate to create the following tables: Person PersonId Address AddressId PersonId This can be easily achieved by using fluent mapping: public class PersonMapping : ClassMap<Person> { public PersonMapping() {

Visualization of ActiveRecord / NHibernate Entity Model

亡梦爱人 提交于 2020-01-03 00:21:19
问题 Has anyone come across a tool to visualize an ActiveRecord / NHibernate entity model? 回答1: The best thing I can think of is generating a class diagram from VisualStudio of your classes .... 回答2: Check out ActiveWriter. Sample screenshot: alt text http://img30.imageshack.us/img30/1001/modelingsurface.png 来源: https://stackoverflow.com/questions/1271626/visualization-of-activerecord-nhibernate-entity-model

Nhibernate - lists on SelectList

久未见 提交于 2020-01-02 23:16:29
问题 I'm using NHibernate and I have come across a problem. I have this entities in my project: Client: public class Client { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string UserName { get; set; } public virtual string Password { get; set; } public virtual IList<Date> Dates { get; set; } public Client() { Dates = new List<Date>(); } } Date: public class Date { public virtual int Id { get; set; } public virtual DateTime DateTime { get; set; }

Nhibernate - lists on SelectList

浪子不回头ぞ 提交于 2020-01-02 23:16:09
问题 I'm using NHibernate and I have come across a problem. I have this entities in my project: Client: public class Client { public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual string UserName { get; set; } public virtual string Password { get; set; } public virtual IList<Date> Dates { get; set; } public Client() { Dates = new List<Date>(); } } Date: public class Date { public virtual int Id { get; set; } public virtual DateTime DateTime { get; set; }

AutoMapper map IdPost to Post

心已入冬 提交于 2020-01-02 18:46:26
问题 I'm trying to map int IdPost on DTO to Post object on Blog object, based on a rule. I would like to achieve this: BlogDTO.IdPost => Blog.Post Post would be loaded by NHibernate: Session.Load(IdPost) How can I achieve this with AutoMapper? 回答1: You could define AfterMap action to load entities using NHibernate in your mapping definition. I'm using something like this for simmilar purpose: mapperConfiguration.CreateMap<DealerDTO, Model.Entities.Dealer.Dealer>() .AfterMap((src, dst) => { if (src

NHibernate, Databinding to DataGridView, Lazy Loading, and Session managment - need advice

我的梦境 提交于 2020-01-02 17:33:11
问题 My main application form (WinForms) has a DataGridView, that uses DataBinding and Fluent NHibernate to display data from a SQLite database. This form is open for the entire time the application is running. For performance reasons, I set the convention DefaultLazy.Always() for all DB access. So far, the only way I've found to make this work is to keep a Session (let's call it MainSession) open all the time for the main form, so NHibernate can lazy load new data as the user navigates with the

NHibernate, Databinding to DataGridView, Lazy Loading, and Session managment - need advice

空扰寡人 提交于 2020-01-02 17:32:05
问题 My main application form (WinForms) has a DataGridView, that uses DataBinding and Fluent NHibernate to display data from a SQLite database. This form is open for the entire time the application is running. For performance reasons, I set the convention DefaultLazy.Always() for all DB access. So far, the only way I've found to make this work is to keep a Session (let's call it MainSession) open all the time for the main form, so NHibernate can lazy load new data as the user navigates with the

Separating the Domain Model and the Data Model

无人久伴 提交于 2020-01-02 12:21:29
问题 My question is similar to this one: Repository pattern and mapping between domain models and Entity Framework. I have done a lot of reading on here about the following: 1) Mapping the ORM directly to the domain model 2) Mapping the ORM to a data model and then mapping the data model to a domain model (and vice versa) I understand the benefits and limitations of both approaches. I also understand the scenarios where one approach is favoured over the other. There are plenty of examples online,

Linq to Sql vs Nhibernate vs SubSonic vs Stored Procedure (Help)

那年仲夏 提交于 2020-01-02 11:02:12
问题 I am looking to develop a website for a news channel . So, Obviously its gonna receive a lot of hits daily and will be updated a lot on daily basis.. I have experience in ASP.Net and SQL Server.. These are the technologies i am considering to work with. Please help me choose the right method considering the amount of load it will take.. Technology?? 1) ASP.Net Webforms 2) ASP.Net MVC 1.0 And data access?? 1) Linq to SQL (Impressive but rumours say Microsoft is abandoning it) 2) Linq to