The problem is NHibernates dependany on log4net. I am trying to build an IoC app with interchangable Loggers, and this thing gets in the way.
Is there a build out there without this dependancy or do I have to do some open source code hacking myself?
...
If we consider this example
But now quantity is a Value Object instead of a primitive type:
public class LineItem
{
public Quantity Quantity { get; set; }
public Product Product { get; set; }
}
instead of:
public class LineItem
{
public int Quantity { get; set; }
public Product Product { get; set; }
}
how could i map...
Hi,
I have the following tables:
create table Users(
Id uniqueidentifier primary key,
InfoId uniqueidentifier not null unique,
Password nvarchar(255) not null
)
Create table UserInfo(
Id uniqueidentifier primary key,
Company nvarchar(255) not null,
ContactPerson nvarchar(255) not null
)
And InfoId is a foreign key referencing ...
Firstly I am relatively new to NHibernate. Got two tables on TaxMapping and Address. A single TaxMapping must have one address and one address can belong to more than one Tax Mapping. They are linked through foreign key
TaxMapping hbm
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespa...
It is possible to specify an arbitrary SQL where clause for collection mappings. For example:
<map name="myEntity" where="foo = 1" />
However if the column name is ambiguous for some reason, the sql fails. For example, this can occur if you are trying to use joins for example.
Given that the table aliases are automatically generated...
What do I need to know when setting up caching using NHibernate, in the case that I have two applications running on different servers, but only one database. Are table dependencies generally sufficient to make sure that weird caching problems don't arise? If so, what sort of polltime should I look at?
...
hi there,
I create the Session factory like:
FluentConfiguration cfg =
Fluently.Configure().Database(MsSqlConfiguration.MsSql2005.ConnectionString(
c => c.Is(dbConnectionString)).**AdoNetBatchSize(100)**.ShowSql()).
Mappings(m => m.FluentMappings.AddFromAssembly(mappingAssembly)).
...
I'm hoping that someone can help me with this issue. I've been racking
my brain and my project is due very soon. Thank You in advance.
I'm receiving an index out of range exception when inserting a new
record. After searching endlessly for information, it was suggested
that the number of column values in my mapping do not match that in ...
Up until recently I had a working service using NHibernate 2.0. I have upgraded to 2.1, but now try to instantiate the ItemManager:
IItemManager manager = Container.Instance.Resolve<IItemManager>();
I get an exception:
Castle.MicroKernel.ComponentNotFoundException was unhandled by user code
Message="No component for supporting the ...
Consider a typical NHibernate context class.
public class SampleContext : NHibernateContext
{
public SampleContext(ISession session)
: base(session)
{ }
public IQueryable<Person> People
{
get { return Session.Linq<Person>(); }
}
public Person GetPerson(int id)
{
get { return Session....
Is there any way I can filter my NHibernate query on the SubType field before I hit the database by adding an ICriterion to my executing DetachedCriteria?
My code looks something like this:
DetachedCriteria detachedCriteria = DetachedCriteria.For(typeof(MyObject));
ProjectionList projectionList = Projections.ProjectionList();
...
First of all, I'm using Fluent NHibernate with LinqToNHibernate.
I've got a query to do a search on a table based on what data the user entered. So, for example, I'm doing something like this:
'build the initial query that we will filter--this is lazy loaded
Dim results As IEnumerable(Of Customers) = Me.GetCustomers()
...
I have a set of fluent object mappings that looks like this:
public class UserMap : ClassMap<User>
{
public UserMap()
{
Map(x => x.Id);
Map(x => x.Status);
}
}
public class SpecialUserMap : SubClassMap<SpecialUser>
{
public SpecialUserMap()
{
Map(x => x.Property);
}
}
public class Direct...
I have two classes: Family and Address.
A family has a physical address and a mailing address.
The mapping file for Family looks like:
....
<id name="Id" column="Id" type="Int32" unsaved-value="0">
<generator class="native"></generator>
</id>
<many-to-one name="PhysicalAddress" class="Address" column="PhysicalAddressId" cascade="all"...
I have a static SessionFactory class that initializes an NHibernate session factory. Because this process is expensive (~5 sec.), I want it to be static so it's only done once, at the beginning of runtime.
The configuration can take a database parameter parameter like so:
public static IPersistenceConfigurer DbConfig { get; set; }
pub...
I have written an hql to support paging
string hql = @"select distinct mr
from MediaResource as mr
where mr.Deleted= false
and mr.Type = :typeId";
SimpleQuery<MediaResource> q = new SimpleQuery<MediaResource>(hql);
q.Se...
I notice that some queries created by NHibernate are executed as batches whereas others are not. When I profile my database using Sql Server Profiler, the event type for these queries is listed as 'SQL:BatchStarting' followed by 'SQL:BatchCompleted', rather than simply RPC:Completed.
Is there any reason why some statements are run as ba...
I am trying to eagerly fetch collections using selects, but all I am
getting is inner joins. What is going on?
Session.CreateCriteria(typeof(Foo))
.SetFetchMode("Bars", FetchMode.Select)
.CreateAlias("Bars", "b")
.SetFetchMode("b.Bazes", FetchMode.Select)
.List();
I have tried changing FetchMode to Eager but that doesn...
I am trying to add and remove elements from a list mapped as .HasMany(), but nHibernate executes some weird queries on this simple scenario:
if (Profile.Artists.Any(x => x.Artist == artist))
{
Profile.Artists.Remove(Profile.Artists.Single(x => x.Artist == artist));
}
else
{
Profile.Artists.Add(new Artist { Artist = artist, User =...
i am in the middle of re factoring an application and i've applied an interface on most entities. I want to change the Save/Update behavior of these entities using the Event mechanism of NH2.1.1. As such i'm implementing an NHibernate.Event.ISaveOrUpdateEventListener
public class SaveOrUpdate : ISaveOrUpdateEventListener
{
public v...