Table Model:
public class UserOwnerShip
{
public virtual int Id { get; set; }
public virtual User User { get; set; }
public virtual City City { get; set; }
public virtual Company Company { get; set; }
public virtual UserRole…
I have NHibernate (with NHibernate.Linq and Fluent NHibernate) set up with query caching. Everything works fine until I do a session.Save(new Widget()) (i.e. SQL INSERT). After that point, all queries on that type Widget miss the query cache.…
Say there is a class A that has a reference to class B like this
class A
{
[NotNull]
string Alpha;
B bObject;
}
class B
{
[NotNull]
string Beta;
}
A a = new A();
a.Alpha = "test"
a.bObject = new b();
a.bObject.Beta = null;
Now…
I've a legacy database that all sites have, it describes specific content in a number of catagory/subcatagory/child item format. Until now, adding/editing the content is either manual work in the tables OR raw sql Windows Forms tool (I built when I…
I have this class that implements IUserType:
public class StringToIntType : IUserType
{
///
/// mutable object = an object whose state CAN be modified after it is created
///
public bool…
I've built the following Dispose method for my Unit Of Work which essentially wraps the active NH session & transaction (transaction set as variable after opening session as to not be replaced if NH session gets new transaction after error)
public…
I need to map a nullable enum in my class but am getting exceptions.
NHibernate.PropertyAccessException: Invalid Cast (check your mapping for property type mismatches); setter of App.Model.Stock ---> System.InvalidCastException: Specified cast is…
Context
I'm creating a web application and one of its features is to allow DB queries via UI. For persistance it uses nHibernate ORM. Below is the repository method which handles the incoming SQL queries:
public IList ExecuteSqlQuery(string…
I am basically trying to create this query with NHibernate ICriteria interface:
SomeTable 1:n AnotherTable
SomeTable has columns: PrimaryKey, NonAggregateColumn
AnotherTable has columns: PrimaryKey, ForeignKey, AnotherNonAggregate,…
I have been trying for three days to figure out this NHibernatefacility thing with Castle and wcf and it's really getting frustrating.
After solving a good dozen of errors, i have come to this one which seems pretty obvious but i can't solve.
This…
I have a console app c# project that depends on NHibernate 3.3.2 and ShapArch.NHibernate 2.0.4.628 which has been compiled with NHibernate 3.3.1 (as far as I know - I might be wrong, but when I created a 2.0.4 SharpArch project it downloaded NH…
In my database there are tables Assignment and Workplace, conceptually, every assignment takes place at exactly one workplace. The Assignment table contains a column Workplace, which is a foreign key referencing the Workplace table's WorkplaceName…
I've inherited a C#/NHibernate/MS SQL Server project and am new to NHibernate. One of the first tasks given to me was to migrate the database from MS SQL Server (2008 R2) to Postgresql 9.2. I'm using the Npgsql 2.0.12 (.net 2.0 version). The…
I'm having one self-referencing class. A child has a reference to its parent and a parent has a list of children. Since the list of children is ordered, I'm trying to map the relation using NHibernate's .
This is my mapping:
…
This should be easy, but I can't seem to figure it out... How can I check if a child on an entity exists without actually getting or fetching it? The child is lazy loaded right now..
so I have two entities:
class A
{
public virtual int Id {…