nhibernate

Security problem w/ NHIbernate in Medium Trust in a Hosted Environment

My hosting provider (hostmysite.com) just changed to running medium trust on their hosted servers. This has caused the following NHibernate to product the following error: [SecurityException: Request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b...

SQL.Data.SqlLite version with NHibernate 2.1

What version/implementation of the SQLLite can be used with NHibernate. I get an error: The IDbCommand and IDbConnection implementation in the assembly SQLite.NET could not be found. Ensure that the assembly SQLite.NET is located in the application directory or in the Global Assembly Cache. If the assembly is in the GAC, ...

NHibernate + ASP.NET MVC: model binder's session is closed

I use custom model binder to bind Order/OrderItem in my actions. This model binder uses ServiceLocator.Current.GetInstance(); where ICart in turn depends on IOrderRepository (not sure if this matters). Now, everything works fine when I create first order item. And when I create the second one. Then I try to display the order which now c...

(Fluent) NHibernate - Inhertiance on object level but not on table level

I have the following idea: Business object implemented as interface or abstract class with certain properties as read only to all layers except the DAL layer. I also want my business objects in another assembly than the DAL (for testing purposes), so marking the properties is not an option for me. Examples could be one to one relations...

fluent nhibernate problem mapping char(1) type

The map. public SocialCodeMap() { Id(x => x.SocialCodeId); Map(x => x.Name); Map(x => x.Code); Map(x => x.DisplayOrder); } And the Class. public class SocialCode { public virtual Guid SocialCodeId { get; set; } public virtual string Name { get; set; } public virtual char Code { ...

Problem in mapping Northwind Customer with NHibernate

As a beginner on NHibernate (2.1.0), I am trying to set up my first unit test using the famous Northwind database. The test goes like this (the configuration files can be found at the end of this question) : ISessionFactory sessionFactory=new Configuration().BuildSessionFactory(); ISession session=sessionFactory.OpenSession(); IList<Cus...

How do I specify a DateTime mapping in nhibernate when using Firebird?

I'm using nhibernate as my ORM and Firebird embedded as the database. How would I got about saving a DateTime to the database? This is an example definition of a class. [Class(Table = "table")] public class Table { private int mId; private DateTime mDate; [Id(Name = "Id"),Generator(1, Class = "native")] public virtual ...

NHibernate 2.1 Example?

I am having problems finding an example project that uses NHibernate 2.1.0. Anyone know of some that are out there, or even open source projects that use it? ...

Disable NHibernate logging

I have an empty app.config file, but I still get NHibernate debug logs NHibernate: SELECT this_.LogID as LogID71_0_, this_.Level as Level71_0_, this_.Message as Message71_0_, this_.EventTime as EventTime71_0_, this_.Component as ... I tried adding a log4net configuration with an ERROR log level, but no use. How can I stop these log me...

NHibernate query optimization

I have an nhibernate query which generates a query like this. I just extracted the example scenario SELECT ID FROM EMPLOYEE WHERE EMPLOYEE.NAME = @P1 AND AND MANAGER_ID IN (@p2, @p3, @p4...@pn )etc. Using NHprofiler I found the query takes around 500 ms. Table has index on name and manager_id. Employee table is around 6 million record...

NHibernate mapping for SQL Server 2008 Hierarchy Data Type

Hi, Just wondering what the best mapping pattern is for NHibernate (latest release) with SQL Server 2008 and the hierarchy data type. Thanks ...

nhibernate mapping Ilist with composite-element.

I have been trying to work with DDD style for my e-commerce application. Most of my business logic are implemented using fake repositories. Now, I would like to use NHibernate to hook my Domain Model to a real database. I have a class Order which contains a list of OrderLines object public IList<OrderLine> OrderLines{ ... } //line 1 ...

Error while creating Fluent NHibernate Session factory.

Hi, I wonder if any one has had any experience of the following fluent config error. faultString = "An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail. I have no problems on my development box but when the dlls are put up on the prod...

NHibernate: set id to interface mapping

I try to write a (fluent) mapping against an interface public interface IOrderDiscount : IDomainObject<long> where public interface IDomainObject<IdT> : IDomainObject { IdT Id { get; } } like so (and all other thinkable varieties of access strategies) Id(d => d.Id, "DiscountId") .GeneratedBy.HiLo("9") .WithUnsavedValue...

NHibernate or FluentNHibernate or ActiveRecord?

I am in a stage of mapping my CSharp classes into database tables. I have decided to use NHibernate as my ORM tool after comparing with other tools. I have never done a real project with NHibernate before and now am considering alternatives for the mapping, ActiveRecord: according to the project's web site, using ActiveRecord can boost...

assembly does not allow partially trusted callers

Hi, I am building a site using fluent NHibernate, which works just fine on the dev box. However, after I uploaded it to my host I get the following when trying to run it. "System.TypeInitializationException: The type initializer for 'NHibernate.ByteCode.Castle.ProxyFactory' threw an exception. ---> System.Security.SecurityException: ...

Can Nhibernate work with 2 different schema?

Hi, Can Nhibernate work with 2 different schema? I have a project to work with say schema A fro few parts and Schema B for others. is this possible with Nhibernate. How can i do that? Thanks Arvind ...

Handling Multiple databases with NHibernate in a single application

At the moment I define the connection properties in a configuration file and only ever connect to one database. I'd like to be able to at some point have a user login, figure out (via a seperate central database maybe) what database they should be connected and from that point on all sessions created will talk to that database. Whats th...

(Detached)Criteria equivalent for HQL's 'index' function.

I have an IDictionary on an object which I'm loading with the following mapping: public class InternalFund : IInternalFund { public virtual IDictionary<DateTime, IValuation> Valuations { get; set; } } <class name="InternalFund"> <map name="Valuations"> <key> <column name="FundID" /> </key> <i...

NHibernate using single configuration file to connect to multiple dbs

I'd like to have a single configuration file and then when I'm creating a session change the hibernate-configuration->session-factory->connection.connection_string property to what I want it to be programmatically? Is it possible? UPDATE: I believe I may be able to do this like this Configuration cfg = new Configuration(); cfg.Configu...