How can I map to a private field with fluent NHibernate AutoPersistenceModel?
public class A
{
private List<B> myField;
public A()
{
myField = new List<B>();
}
public IList<B> MyBs
{
get { return myField; }
}
}
Is there a fieldconvention for...
How do I "turn on" cascading saves using AutoMap Persistence Model with Fluent NHibernate?
As in:
I Save the Person and the Arm should also be saved. Currently I get
"object references an unsaved transient instance - save the transient instance before flushing"
public class Person : DomainEntity
{
public virtual Arm LeftArm { g...
Hello.
i got some problems using EF with AutoMapper. =/
for example :
i got 2 related entities ( Customers and Orders )
and theyr DTO classes :
class CustomerDTO
{
public string CustomerID {get;set;}
public string CustomerName {get;set;}
public IList< OrderDTO > Orders {get;set;}
}
class OrderDTO
{
public string OrderID ...
Hello,
I am getting (a little bit to) deep into automapping with the fluent interface of NHibernate. Very nice thing, but I ran into a little problem with DateTimes. I need to change the data format to timestamp, otherwise NHibernate truncates milliseconds.
I found several sources of information, the best one was:
AutoMapping Info 1 whe...
This one has me scratching my head, so I'm hoping a second pair of eyes can help me out here.
Setup:
I've got a base class called DomainEntity that all of my data transfer objects use. It basically only defines a property called Id (which is an integer).
I've got data transfer objects: Blog, Post, User
DomainEntity is in the namespace...
When automapping a joined subclass in fluent nhibernate, I can't figure out how to give the joined subclass a primary key.
public class Address:Entity {
public virtual string Address1 { get; set; }
public virtual string Address2 { get; set; }
public virtual string City { get; set; }
public virtual string State { get; set; }
public ...
How can I map a DataReder object into a class object by using generics?
For example I need to do the following:
public class Mapper<T>
{
public static List<T> MapObject(IDataReader dr)
{
List<T> objects = new List<T>();
while (dr.Read())
{
//Mapping goes here...
...
I am automapping measurement classes (that implement interface IMeasurement) as components.
This works fine, but I have some attributes in the components I would like to ignore.
Apparently I cannot use IgnoreProperty on the measurement classes themselves, i.e.:
[ .ForTypesThatDeriveFrom(p => p.IgnoreProperty(x => x._uomSpecified)) ]
w...
Im new to NHibernate, the configuration aspect of it has always seemed overly onerous to me. Yesterday, I came across the Auto Mapping features of Fluent NHibernate and was suitably impressed.
To educate myself, I set myself the challenge of attempting the 'Getting Started First Project' (http://wiki.fluentnhibernate.org/show/GettingSta...
I have this test in my test base:
public void WorksWithAreaUsers()
{
using (new TransactionScope())
{
//arrange
var userBusiness = new UserBusiness();
var user = new User
{
Name = "TestUser###",
Login = "domain\test-user###"
};
userBusiness.Add(user);
var...
Summary:
I want to save two classes of the same name and different namespaces with the Fluent NHibernate Automapper
Context
I'm writing having to import a lot of different objects to database for testing. I'll eventually write mappers to a proper model.
I've been using code gen and Fluent NHibernate to take these DTOs and dump them s...
Hi
There is o possibility to create a convention for Column naming:
I have this peace of code:
public AutoPersistenceModel Generate()
{
var result = AutoPersistenceModel.MapEntitiesFromAssemblyOf()
.Where(GetAutoMappingFilter)
.WithConvention(GetConventions);
return result;
...
Hi there,
i have been successfully working with linq2sql and the linq DTOs (the classes that are created by linq2sql) ....
I am confused, i have the task of updating an old application and i can see that my DTOs will be used how they should be .... to transport date
I am using the repository pattern so i am passing data from the repos...
I am new to NHibernate and am running into some issues getting the Automap functionality to work properly. Here are a couple of issues I am having.
The getting started wiki for Fluent NHibernate (http://wiki.fluentnhibernate.org/Getting_started) defines a sample with store, product, and employee classes--as well as the mapping for thos...
I am using Fluent-NHibernate (with automapping) to generate my tables but would like to choose a different clustered index than the ID field which is used by default. How can you create clustered indexes with Fluent NHibernate on a field other than the default Primary Key field?
The primary reasoning behind this is simple. I am using Gu...
I am attempting to use the Fluent-NHibernate automapping functionality (in the latest version of the software) and am running into problems using Guids as the Primary Key fields. If I use integer fields for the primary keys, the tables are generated successfully and all Nhibernate functionality seems to work fine. FYI, I am using NHibern...
This is a Fluent NHibernate newbie question, so bear with me.
I have a set of classes, and I'm applying the Automapping capabilities to it.
But I need to mark one of the properties of one of the techniques with a Unique constraint.
In the Fluent Wiki, it says
Sometimes it's necessary to make
slight changes to a specific entity,...
I am trying to modify the Automapping conventsion in Fluent NHibernate to use ".AsSet" for OneToMany mappings, rather than ".AsBag" (which, judging from the hbm files exported, appears to be the default).
I have spent hours pouring over the documentation, and I understand that I need to do a
"AutoMap.AssemblyOf<T>().Conventions.Add<Cu...
I'm using the following:
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(connectionString))
.Mappings(m => m.AutoMappings.Add(AutoMap.AssemblyOf<Incident>()
.Where(t => t.Namespace.StartsWith("EDA.DomainModel.POCO"))))
.ExposeConfiguration(BuildSchema)
.BuildSessionFac...
Right now, I'm switching my project over from the classic fluent nhibernate style of manually defining a ClassMap for each domain entity, to having the auto-mapper auto-generate the mappings for me. But I'd like to keep using the classes I've already mapped in the classic style, until I can tweak the automappings to match the old classi...