Hi,

 

I am trying to write a web application in ASP.NET using 3.2 mapping by code.
I copied the same mappings and classes from my working winforms application
but got the error below in mapping stage. Is there any specific
configuration or something I have to do in web application in order
nhibernate to run?

 

Code:

 

        var mapper = new ModelMapper();

 
mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());

        var mapping = mapper.CompileMappingForAllExplicitlyAddedEntities();
//ERROR

        NhConf = ConfigureNHibernate();

        NhConf.AddMapping(mapping);

        SchemaMetadataUpdater.QuoteTableAndColumns(NhConf);

        SessionFactory = NhConf.BuildSessionFactory();

 

 

 

Server Error in '/07-RPD' Application. 

  _____  

Object reference not set to an instance of an object. 

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error: 


 

Line 82:
mapper.AddMappings(Assembly.GetExecutingAssembly().GetExportedTypes());

Line 83: 

Line 84:         var mapping =
mapper.CompileMappingForAllExplicitlyAddedEntities();

Line 85: 

Line 86:         return mapping;


Source File: c:\Users\Mert\Documents\Visual Studio
2010\Projects\07-RPD\App_Code\Persistence\NHibernateHelper.cs Line: 84 

Stack Trace: 


 

[NullReferenceException: Object reference not set to an instance of an
object.]

   NHibernate.Mapping.ByCode.<>c__DisplayClass3.<CompileMappingFor>b__2(Type
t) in
d:\CSharp\NH\NH\nhibernate\src\NHibernate\Mapping\ByCode\ModelMapper.cs:549

   System.Linq.Enumerable.All(IEnumerable`1 source, Func`2 predicate) +146

   NHibernate.Mapping.ByCode.ModelMapper.CompileMappingFor(IEnumerable`1
types) in
d:\CSharp\NH\NH\nhibernate\src\NHibernate\Mapping\ByCode\ModelMapper.cs:549

 
NHibernate.Mapping.ByCode.ModelMapper.CompileMappingForAllExplicitlyAddedEnt
ities() in
d:\CSharp\NH\NH\nhibernate\src\NHibernate\Mapping\ByCode\ModelMapper.cs:1771

   NHibernateHelper.GetMappings() in c:\Users\Mert\Documents\Visual Studio
2010\Projects\07-RPD\App_Code\Persistence\NHibernateHelper.cs:84

   NHibernateHelper.Setup() in c:\Users\Mert\Documents\Visual Studio
2010\Projects\07-RPD\App_Code\Persistence\NHibernateHelper.cs:95

   ASP.global_asax.Application_Start(Object sender, EventArgs e) in
c:\Users\Mert\Documents\Visual Studio 2010\Projects\07-RPD\Global.asax:8

 

  _____  

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.0.30319.17020

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to