Hi,
I'm looking for way in Fluent NHibernate to get a list of all object of type PARENT
using criteria.
I have a father object and a derived child.
The father contains a list of childs.
The problem is that when I use:
ICriteria crit = session.CreateCriteria(typeof(Parent))
IList<Parent> myRes = crit.List<Parnet>()
NH return back t...
In the current application I'm developing I'm using fluent nhibernate to configure nhibernate for use as an ORM. I want to be able to add a prefix to all the table names used in the application, so that if I use a database that is already servicing another application, there are no naming conflicts between the two applications.
So for...
Is it possible to map entities from multiple assemblies in Fluent NHibernate?
I tried
AutoPersistenceModel
.MapEntitiesFromAssemblyOf<Class1>()
.AddEntityAssembly(assembly)
But it only loads entities from 'assembly' and not from parent assembly of Class1.
EDIT.
I figured it out. I had to update Fluent NHibernate to version 1.0, wher...
Hi
I'm not sure if my problem is solvable in a more or less comfortable way.
There is a class Person which has mapped 'hasOne' a participant.
The person has a birthday but this field is not required on the person itself. But if I would like to add a participant to the person then the birthday is required.
How to get rid of this
mo...
A common thing that many people do with NHibernate is setting of auditing fields (e.g. CreatedDate, LastModifiedDate) when they save an entity. There are lots of blog posts on how to do this sort of thing using NHibernate events.
This one uses the SaveUpdate event:
http://www.codinginstinct.com/2008/04/nhibernate-20-events-and-listener...
I'm new to NHibernate (and ORMS) and trying to come to grips with the myriad of different options it presents. For reference, I'm using Fluent NHibernate with seperate business objects which in turn use DTO's purely for data access. My application architecture must support both windows and web "front ends".
My quandry is one of general ...
Hello ,
I am trying to connect to the existing db in oracle with fluentmapping .
I got
Mapping over CUstomer
public CustomerMapping()
{
Not.LazyLoad();
Id(x => x.Cst_Recid).GeneratedBy.Increment() ;
}
and i am trying to create session
public static ISessionFactory CreateSessionFactory()
{
retur...
I have the following mapping class that requires the use of a composite id. The issue I am having is that the exposed related entities (OrganizationSurvey) and (Section) are both coming back as null. However, the entities do exist in their respective tables...
What am I not seeing or doing wrong..??
public SectionResponseMap()
...
Hello guys... My hbm is :
<class name="Core.clsPessoa,Core" table="tblPessoa" lazy="true">
<id name="ID" column="CodigoPessoa" type="Int32" unsaved-value="0">
<generator class="identity"/>
</id>
<property column="CodigoCEP" name="CodigoCEP" type="String" />
<joined-subclass name="Core.clsPessoaJuridica,Core" table="tblPessoaJuri...
i'll use some sample code to demonstrate my problem...
this is an entity
public class Channel : EntityBase
{
[DataMember]
public virtual IList<LocalChannel> LocalChannels { get; set; }
}
local channel has a string property.
this 2 classes mapped fluently and works fine with the has many relation.
the problem is in the wcf ...
I'll try to keep this terse, but hopefully won't miss any important information in my troubles. The code I believe provides all details, but I've left out the noise (it's VB, so there's lots of noise :) ).
A "Case" object has many "Assignments":
Public Class Case
Property CaseId As Guid
Property Assignments As ISet(Of CaseAssignm...
I've read that using a back tick ` should allow for using of reserved words. I'm using SQL Server and Fluent NHibernate and have a column name "File". If I map it with
"`File"
it tries using
[Fil]
so it's adding the brackets correctly, but dropping the "e" from the end. If I map it as
"`Filee"
it uses
[File]
correctly.
Am ...
I have a simple class that looks like this...
public class Item {
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual int ParentId { get; set; }
public virtual IList<Item> Children { get; private set; }
public Item() {
Children = new List<Item>();
}
}
... where ...
Please consider the following simple use case:
public class Foo
{
public virtual int Id
{
get;
protected set;
}
public virtual IBar Bar
{
get;
set;
}
}
public interface IBar
{
string Text
{
get;
set;
}
}
public class Bar : IBar
{ ...
Why fluentnhibernate (v. 1.0) when you map the entities (not using automap), all must be virtual, even those that are not mapped? There is a way not to set props / methods virtual ?
Mic.
...
Is it possible to test Nullable Types with PersistenceSpecification?
var approved = new Nullable<DateTime>();
spec.CheckProperty(x => x.Approved, approved);
Currently this throws a NullReferenceException. Am I doing it wrong?
...
Whats the best, most consistent way to check if a table exists in NHibernate (or with Fluent-Nhibernate)?
Is it even possible? I mean it seems like a simple task for such a heavy-duty ORM.
Also on a related question, can you check if a set of tables or a whole schema exists with NHibernate?
...
I am trying to work out how to manage the following relationships
A Store has many Products
A Product is in many Stores
A Store knows how many of each Product it has
In the database I have 3 tables Stores, Products and a StoreProducts that has StoreId, ProductId and Quantity.
How would I map this in nHibernate or fluent nHibernate?
...
Hi,
This problem pops around the network for years, I've found no good solution yet.
The topic is passing a List of Objects which have circular reference inside them populated by NHibernate (with or without lazy load - some sites sais it can't be done with lazy)
Here is the example:
[DataContract]
class Person
{
[DataMemeber]
str...
Hi there,
I am using for some legacy db the corresponding domainclasses with mappings.
Now the Ids of the entities are calculated by some stored Procedure in the DB which gives back the Id for the new row.(Its legacy, I cant change this)
Now I create the new entity , set the Id and Call Save. But nothing happens. no exeption. Even NH Pr...