I seem to have major problems getting a one to many relationship to work in nhibernate
and my classes are
public class Kitten
{
public virtual int? Id { get; set; }
public virtual String Name { get; set; }
}
public c...
What's the best approach for testing multiple db's in a s#arparch project?
The current SetUp() code in MappingIntegrationTests tries to test each assembly against the first database.
string[] mappingAssemblies = RepositoryTestsHelper.GetMappingAssemblies();
configuration = NHibernateSession.Init(new SimpleSessionStorage(), mappingAss...
I'm a big believer in DRY so after setting up ClassMap objects in fluent nhibernate, how can I consume these mappings in code not using Nhibernate?
Edit: Example, I have a class that is mapped but also uses a stored procedure to populate itself and it's children (and their children) in a single database call. When populating objects fro...
I have the following statement that's throwing an error I don't understand:
return (int) _session.CreateCriteria<T>()
.Add(LambdaSubquery.Property<Fund>(x => x.Id)
.In(GetAvailableIdsPerDataUniverse(x => x.GetDataUniverseId())))
.AddNameSearchCriteria<T>(searchExpression)
.SetProjection(LambdaProjection.Count<T>(e =>...
Hi,
I'm using NHibernate and Microsoft Access. My database file is fairly large ( ~500 MB ) and my app. is slow when writing to the database and I was wondering if any of you have experience with NHibernate and large Access databases. I want to know if this slowness in the app. is an known issue.
Regards,
MadSeb
P.S I did "compact a...
Searched various NHibernate lists and haven't come up with a definitive answer. The SQL2008 dialect doesn't appear to have support for the HierarchyID data type - new date and time types only.
Does anyone have a good implementation or an effective workaround? I'd really like to leverage HierarchyID in a new app of mine. Support for t...
I just completed mapping 100~ tables from our production Oracle database. Along the way I noticed that many relationships were not modelling. Mostly foreign keys.
Should I modify my mappings to include the appropriate relationships? Or should I keep the mapping as is to reflect the database 100%?
I'm more inclined the map the appropria...
Advertisements advertisements = NHibernateSession.CreateCriteria(typeof(Advertisements))
.Add(Restrictions.Eq(AdvertisementsProperties.Price.ToString(), price))
.Add(Restrictions.Eq(AdvertisementsProperties.HollidayDuration.ToString(), hollidayDuration))
.Add(Restrictions.Eq(Adv...
Hi,
I would like to "extend" my domain classes without having to add data to the domain classes themselves. Concider I have the following class:
public class Person
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
}
And I have the following table in the database:
tblPersons---------------...
I used to use NHibernate with repository interfaces.
What is the proper way to use this pattern with EF?
How can I implement this repository interface, for a RepositoryBase<T>?
public interface IRepository<T>
{
T GetById(object id);
void Save(T entity);
T[] GetAll();
void Delete(T entity);
}
...
Hello,
I'm new to fluent nHiberbate and wanting to put into use in one of my projects. And I'm currently having trouble mapping a class that has both inheritance and self-referencing properties.
Here's my scenario:
I have an abstract class called Applicant
public abstract class Applicant: IApplicant
{
public virtual long Id {...
Fluent NHibernate or NHibernate, Which one should we prefer for linq support?
...
i have the following code using Nhibernate.Linq
var apps = Session.Linq<History>().OrderByDescending(r => r.LastUpdated).Take(50);
Console.Write(apps.Count());
the count returns 1000 (NOT 50 which is what i would have expected)
any ideas why the .Take() is not working?
...
Hi all
I maintain an application which has many domain entities that draw data from more than one database. The way this normally works is that the entities are loaded from Database A (in which most of their fields are stored). when a property corresponding to data in Database B is called, the entity fires off SQL to Database B to get a...
I am building an object from multiple datasources. Does anyone know whether this is possible in NHibernate and how. I should mention that one source is SQL the other ORACLE.
...
At my company we are currently using the classic n-tier architecture using NHibernate as our persistence layer with fat objects. Seeing many issues with this pattern, such as full hydration of the object graph when entities are retrieved from the database we have been looking in to other alternatives.
In this process we have moved to a...
I have a use case where a user gets a list of products, and can select multiple products and active or deactivate them.
The model for this list is immutable, and I have a repository which takes a list of the model that should deactivate them all.
I do have another full product editing model, but I'd rather not have to load up hundreds ...
I have multiple databases in my SharpArchitecture project and followed the guide outlined here:
http://wiki.sharparchitecture.net/FAQ.ashx
Everything works fine, except for my entities with assigned ids. I get a "database already configured" when trying to startup the application. Through some digging I get:
"Identity type must be int...
Hello Everyone!!
I have been doing nhibernate since many days. But Today I stuck at a frustrating issue i.e. mapping exception.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="IPC.Base.Domains" assembly="IPC">
<class name="MenuItem" table="dbo.COR_MenuItem" default-access="...
I want to map an entity from database, but I can't figure out how do this using NHibernate.
My entity "Module" have just three properties: id, name and a list of "Entities".
But my database table have the columns: id, cd_entity, cd_label.
So this is my problem. How can I map the property cd_label (that need join another table TB_LABE...