There's a few other posts on mapping Enums to the DB with ActiveRecord, but none of them answer my question. I have an enum called OrderState:
public enum OrderState {InQueue, Ordered, Error, Cancelled}
And I have the following property on the table:
[Property(NotNull = true, SqlType = "orderstate", ColumnType = "DB.EnumMapper, WebS...
Currently, we use NHibernate to map business objects to database tables. Said business objects enforce business rules: The set accessors will throw an exception on the spot if the contract for that property is violated. Also, the properties enforce relationships with other objects (sometimes bidirectional!). Well, whenever NHibernate ...
How should one handle the situation where you may need to filter by a group of users.
Here is the scenario.
I have an administrator role in my company. I should be able to see all the data belonging to me plus all the other users who I have control over.
A plain old user however should only be able to access their own data.
If you a...
Hi, I'm struggling with a little problem and starting to arrive at the conclusion it's simply not possible.
I have a Table called Group. As with most of these systems Group has a ParentGroup and a Children collection. So the Table Group looks like this:
Group
-ID (PK)
-Name
-ParentId (FK)
I did my mappings using FNH AutoMapping...
I have a dozen or so named queries in my NHibernate project and I want to execute them against a test database in unit tests to make sure the syntax still matches the changing domain/database model. Currently I have a unit test for each named query where I get and execute the query, for example:
IQuery query = session.GetNamedQuery("Ge...
I have a bunch of domain entities that can be keyword tagged (a Tag is also an entity.)
I want to do a normal many-to-many (Tag -> TagReview <- Review) table relationship
but I don't want to have to create a new concrete relationship on both the Entity and Tag every single time I add a new entity.
I was hoping to do a generic based Ta...
I am getting the following error when i tried and save my "Company" entity in my mvc application
a different object with the same identifier value was already associated with the session: 2, of entity:
I am using an IOC container
private class EStoreDependencies : NinjectModule
{
public override void Load()
{
...
I'm having trouble saving a many-to-many relationship with nhibernate. I searched and looked at almost every same question in SO and google but nothing works.
The single classes are update correctly but nothing is inserted in the join-table.
I have 2 classes: Event and Category.
The mapping is this (I updated the two mapping and added ...
I've got a web application that is 99% read-only, with a separate service that updates the database at specific intervals (like every 10 minutes). How can this service tell the application to invalidate it's second-level cache? Is it actually important? (I don't actually care if I have too much stale data) If I don't invalidate the cache...
I have an web application that uses NHibernate as ORM. I enable lazy loading for my classes but I want to load some classes without lazy in a special situation.
Now is there any utility or built in class in NHibernate that force a class to load it without lazy in a special situation?
Note: I don't want to remove lazy property in my map...
Hi ,
i have 2 entities : ( person ) & (Address)
with follwing mapping :
<class name="Adress" table="Adress" lazy="false">
<id name="Id" column="Id">
<generator class="native" />
</id>
<many-to-one name="Person" class="Person">
<column name="PersonId" />
</many-to-one>
</class>
<class name="Person" table="Pe...
Hi,
My Domain Layer is implemented with Domain Model, and after PEAA, in Data Layer I have to use Data Mapper.
NHiberbate is an implemantation of Data Mapper in C#?
What alternative I have to use Data Mapper in a C# project?
Thanks a lot!
...
I have a situation where I have 3 tables: StockItem, Office and StockItemPrice. The price for each StockItem can be different for each Office.
StockItem(
ID
Name
)
Office(
ID
Name
)
StockItemPrice(
ID
StockItemID
OfficeID
Price
)
I've set up a schema with 2 many-to-one relations to link StockItem and Office. So in ...
When must we use eager loading in NHibernate? What is it's usage?
...
I am trying out Castle ActiveRecord. I want to use the Validation features AND the LINQ features.
In order to use LINQ, you can either:
My preference: Make your entities inherit from ActiveRecordLinqBase<T>, then to query:
var blogs = (from b in Blog.Queryable select b).ToList();
Use ActiveRecordLinq.AsQueryable<T>, e.g.:
var blogs ...
Hi all
Say I got 3 entities: Business, Employee and Payment. A payment has a foreign key to an Employee, while the Employee has an foreign key to a business.
Now, I want to create a query which gives me all payments for a given business. I really don't have a clue about how to do this - I guess I want something like:
mySession.CreateC...
I have the following mapping files:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="MyAssembly" namespace="EntityNamespace">
<class name="Server" xmlns="urn:nhibernate-mapping-2.2" table="tblServer" >
<id name="Id" type="int">
<generator class="native"...
This is a problem of unidirectional one-to-one mapping in NHibernate.
Student.cs
public class Student
{
public int ID { get; set; }
public int Roll { get; set; }
public int RegNo { get; set; }
public string Name { get; set; }
public StudentDetail StudentDetail { get; set; }
}
StudentDetail.cs
public class Studen...
Possible Duplicate:
adding an nHibernate mapping at run time?
All of the NHibernate examples I've see that use hbm files have the hbm.xml file set as an embedded resource with "do not copy" chosen in the file properties. This means that if a database column name were to change in production, the app would have to be recompiled...
Hi guys,
Is it possible to use NHibernate criteria API to delete many entities at once.
Best regards,
Alexey Zakharov.
...