Saturday, 15 August 2015

c# - FluentNhibernate TypeLoadException -



c# - FluentNhibernate TypeLoadException -

i'm trying build sample mvc3 project using fluentnhibernate, , i'm getting typeloadexception when seek create sessionfactory.

sessionfactory

//using system; //using nhibernate; //using nhibernate.cfg; //using fluentnhibernate.cfg; //using fluentnhibernate.cfg.db; //using system.collections.generic; //using system.linq; //using system.web; //using system.web.mvc; public class sessionprovider { public sessionprovider () { } public static isessionfactory buildfactory() { homecoming fluently.configure()//explosion here .database(mysqlconfiguration.standard.connectionstring( c => c.fromconnectionstringwithkey("dashboardmodels") )) .mappings(m => m.fluentmappings.addfromassemblyof<accounts>()) .buildsessionfactory(); } }

global.asax

public class mvcapplication : system.web.httpapplication { public static isessionfactory sessionfactory = sessionprovider.buildfactory(); public static void registerglobalfilters(globalfiltercollection filters) { filters.add(new handleerrorattribute()); } public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( "default", // route name "{controller}/{action}/{id}", // url parameters new { controller = "home", action = "index", id = urlparameter.optional } // parameter defaults ); } protected void application_start() { arearegistration.registerallareas(); registerglobalfilters(globalfilters.filters); registerroutes(routetable.routes); } }

exception

system.typeinitializationexception: exception thrown type initializer system.web.configuration.webconfigurationmanager ---> system.exception: method not found: 'system.configuration.configurationmanager.get_configurationfactory'. --- end of inner exception stack trace --- @ (wrapper xdomain-invoke) system.appdomain:docallback (system.crossappdomaindelegate) @ (wrapper remoting-invoke-with-check) system.appdomain:docallback (system.crossappdomaindelegate) @ system.web.hosting.applicationhost.createapplicationhost (system.type hosttype, system.string virtualdir, system.string physicaldir) [0x00000] in <filename unknown>:0 @ mono.webserver.vpathtohost.createhost (mono.webserver.applicationserver server, mono.webserver.websource websource) [0x00000] in <filename unknown>:0 @ mono.webserver.xsp.server.realmain (system.string[] args, boolean root, iapplicationhost ext_apphost, boolean quiet) [0x00000] in <filename unknown>:0 @ mono.webserver.xsp.server.main (system.string[] args) [0x00000] in <filename unknown>:0

i've used exact code elsewhere in past no problem, , don't know issue. doing wrong here?

i have learned if have errors in monodevelop, delete project, throw laptop out window, , have clear opening jump out of behind it. :p

honestly, had delete project, utilize backup , exact steps first took , worked. i'm sorry advice save many backups along way. if have errors in output, none when build it. delete , seek again. 1 time compiler confused take deed of god prepare it.

c# asp.net-mvc-3 fluent-nhibernate monodevelop

No comments:

Post a Comment