Hi,
I have a scenario where I have a parent class with some definitions we can call if Foo to be unique and then a child class that I chose to call Bar. Together they make Foo Bar! :)
public class Foo
{
public Foo()
{
Bars = new List<Bar>();
}
// Internal id only, should probably not even map it
public virtua...
I posted the question in the Fluent-NHibernate newgroup but so far there has been no answer from the void.
Is there a Fluent NHibernate mapping for the NHibernate "trigger-identity" method of generating primary keys.
Thanks
...
Hello,
I am using Fluent NHibernate with table per subclass inheritance mapping.
I want to reference to a list of specific objects, but i can't figure out, how to restict the result to objects of one specific class.
class PetMap : ClassMap<Pet>
{
public PetMap()
{
Id(c => c.ID).GeneratedBy.Identity();
}
...
I have a class with a bounding box, and I want to have subclasses that set the values of the bounding box, based on their attributes
public class LocationBase : BaseEntity
{
public virtual int Id { get; set; }
public virtual double North { get; set; }
public virtual double East { get; set; }
public virtual double So...
Given the following Fluent NHibernate maps:
public class FastTrackPackageClassMap : ClassMap<FastTrackPackage>
{
public FastTrackPackageClassMap()
{
Id(x => x.Id);
References(x => x.UserCreated, "UserIdCreated").Cascade.None();
References(x => x.UserSent, "UserIdSent").Nullable().Cascade.None();
H...
Hi,
I have a varbinary field in my sql server database that needs to be varbinary(max). I create my database with NHibernate and I use Fluent Nhibernate for my mappings.
I also use SQLite for my unit tests, I use the same mappings I just change the configuration before creating the database in memory.
I get the following problem.
I c...
whats the difference between using join() and using hasmany mappings to map entities.
Can I get same results using both of these features--- I would think Join() would let you think data driven way?
...
I'm currently learning NHibernate and I would like to data-bind to Web controls (i.e. GridView).
In my current example I am using Fluent NHibernate to map two tables to their business objects (Project and ProjectStatus). I also have a "Project has a ProjectStatus" (many-to-one) relationship.
Structure of Project class:
Project.ID
Proj...
I'm trying add the the followings in my FNH configuration SessionManager class.
I have 20+ Entities to map and they're all sitting in the same project under Entities folder. ie. ProjName.BusinessLogic.Entities
The mapping classes are under ProjName.BusinessLogic.Mappings
This FNHSessionManager.cs file is under ProjName.BusinessLogic.DAL...
I started creating a domain model and now I asking myself, how can I map this domain model to a NHibernate Data Model ((using Fluent NHibernate)? Is there anywhere a good and simple example of how to do that?
With Data Model I didn't think about the physical/relational Database Model(!) What I meant was the Data Model in the Data Access...
Hi! I'm getting the following error: "Can't figure out what the other side of a many-to-many should be."
Team Entity:
public class Team : IEntity
{
public int Id { get; set; }
public string Name { get; set; }
public IList<Employee> Employee { get; set; }
public Team()
{
Employee = new List<Employee>();
...
I'm using Compare .NET Objects to test whether my POCOs are persisted correctly to a test database. Let's take an example POCO:
public class NoahsArk
{
public virtual Noah Noah { get; set; }
}
And the mapping file, using FNH:
public class NoahsArkMap : ClassMap<NoahsArk>
{
References(x => x.Noah).Cascade.All();
}
Now, I run...
I want to be flexible even after deploying my code so I like to use the hibernate.cfg.xml file for configuring NHibernate. Now, I am planning to use Fluent NHibernate to do all my Class => Table mapping. Is there a way I could use the old NHibernate Configuration class to configure Fluent NHibernate?
...
hi, really struggling to resolve this issue. using nhibernate Im trying to join two different tables from two different databases but im getting a collation conflict error.
To resolve this issue i know i need to append "collate Latin1_General_CI_AS" to the end of my sql string but have no idea how to do it using nhibernate.
Error:
Can...
I have a class A in one assembly and subclass B that extends A in another assembly that I am trying to auto-map. There are classes that have relationships to A, and classes that have relationships to B. The subclass strategy is table-per-inheritance-hierarchy. (NOT joined-subclass)
Depending on the order of how I add the persistence mod...
i have (2) tables which have primary keys on a legacy db. i want to map non-primary key properties of these tables. for example,
USERS PROFILES
----- -------
UserId int ProfileId int
Name string ...
someId int <-----> someotherId int
using Fluent nhibernate, how do i map t...
It appears that NHibernate cannot automap more than one IList of a given type in an entity.
Consider the following two entities (based on the Examples.FirstProject sample code that is included with the Fluent NHibernate source code).
public class Employee
{
public virtual int Id { get; private set; }
public virtual string Fir...
Hi! I got the following error message:
System.IndexOutOfRangeException: Invalid index 9 for this SqlParameterCollection with Count=9..
And I absolutely wonder why oO?!
The database schema and the hbm.xml files were all correctly created with FluentNHibernate.
The error ocurrs in the CanCorrectlyMapBookmethod, the PersistenceSpecifica...
How can I rewrite following so that I can do ObjectFactory.GetNamedInstance("MyNHConfiguration") at later time. "Configuration" is in the variable "cfg" under ExposeConfiguration lambda
ForRequestedType<ISessionFactory>()
.CacheBy(InstanceScope.Singleton)
.AddInstances(x => x.ConstructedBy(() =>
...
I have an abstract base class, Entity, that all my POCOs derive from:
public abstract class Entity
{
public virtual Guid Id { get; set; }
}
And the mapping file:
public class EntityMap<T> : ClassMap<T> where T : Entity
{
public EntityMap
{
Id(x => x.Id);
}
}
This way, I don't have to write Id(x => x.Id) in e...