Actually the last error message was a bug in the SQLite provider. Installing
1.6.4 works fine but I had to change the references in my project files to
make it work. You know unload project -> edit project file.
It looks like the new version of nhibernate uses some different setup and
there for you need to supply some IDictionary<string, string> of the
configuration. I never got it to work with the nh-config.xml. I tried all
names I found and I tried every possible location. Have like 2 MB of nh
config xml lying around :) What finally did work for me was:
IDictionary<string, string> properties = new Dictionary<string,
string>();
properties.Add("proxyfactory.factory_class",
"NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle");
properties.Add("dialect", "NHibernate.Dialect.SQLite");
properties.Add("connection.driver_class",
"NHibernate.Driver.SQLite20Driver");
properties.Add("connection.connection_string", @"Data
Source=D:\Projects\Name\src\Client\App_Data\db.db");
Just in case someone else has the same problems as I did.
2009/7/11 Mikael Henriksson <[email protected]>
> Ok I found a workaround for the ByteCode problem after upgrading to
> NHibernate RC1:
> IDictionary<string, string> properties = new Dictionary<string,
> string>();
> properties.Add("proxyfactory.factory_class",
> "NHibernate.ByteCode.Castle.ProxyFactoryFactory,
> NHibernate.ByteCode.Castle");
> _sessionFactory = Fluently.Configure()
>
> .Database(SQLiteConfiguration.Standard.UsingFile(PathToSqlLiteDb))
> .Mappings(m => m.FluentMappings
> .Add<AddressMap>()
> .Add<ClubMap>()
> .Add<ScheduleMap>()
> .Add<ContactTypeMap>()
> .Add<ContactMap>()
> .Add<TournamentTypeMap>()
> .Add<TournamentMap>()
> .Add<ResultTypeMap>()
> .Add<ResultMap>()
> .Add<NewsMap>())
> .ExposeConfiguration(BuildSchema)
> .BuildConfiguration().AddProperties(properties)
> .BuildSessionFactory();
>
> _session = _sessionFactory.OpenSession();
>
> Now according to this message:
>
>
> System.Resources.MissingManifestResourceException: Could not find any
> resources appropriate for the specified culture or the neutral culture. Make
> sure "System.Data.SQLite.SR.resources" was correctly embedded or linked into
> assembly "System.Data.SQLite" at compile time, or that all the satellite
> assemblies required are loadable and fully signed.
> at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
> culture, Boolean createIfNotExists, Boolean tryParents)
> at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
> culture, Boolean createIfNotExists, Boolean tryParents)
> at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo
> culture, Boolean createIfNotExists, Boolean tryParents)
> at System.Resources.ResourceManager.GetString(String name, CultureInfo
> culture)
> at System.Data.SQLite.SR.get_Keywords()
> at System.Data.SQLite.SQLiteConnection.Schema_ReservedWords()
> at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName,
> String[] restrictionValues)
> at System.Data.SQLite.SQLiteConnection.GetSchema(String collectionName)
> at NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetReservedWords()
> at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect
> dialect, IConnectionHelper connectionHelper)
> at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.Update(ISessionFactory
> sessionFactory)
> at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping
> mapping, Settings settings, EventListeners listeners)
> at NHibernate.Cfg.Configuration.BuildSessionFactory()
> at WexioBridgen.Data.ContextManager.UpdateAndConfigure() in
> ContextManager.cs: line 47
> at WexioBridgen.Data.ContextManager..ctor(Boolean reconfigure) in
> ContextManager.cs: line 29
> at WexioBridgen.Client.Tests.DatabaseSetup.ReconfigureDatabase() in
> DatabaseSetup.cs: line 22
>
> And this blog
> post<http://www.mystuffisallhere.com/blog/post/2009/06/29/NHibernate-on-SQLite-30-e28093-a-workaround-for-e2809cCould-not-find-any-resources-appropriate-for-the-specified-culture-or-the-neutral-culturee2809d.aspx>there
> seems to be an issue with the newest SQLite provider... Trying to
> downgrade to 1.6.0
>
> 2009/7/11 Mikael Henriksson <[email protected]>
>
>> Unfortuantely I was dead wrong. Even if I try to run it in the constructor
>> of PersistenceConfiguration.cs it doesn't stick even though I added
>> references etc to it. My take right now is that NHibernate somehow changed
>> how this ByteCode provider is stored!!
>>
>> I'll get Ayende for this one!
>>
>> 2009/7/11 Mikael Henriksson <[email protected]>
>>
>> Aaaah but now I get it. I have to add this fucker:
>>> ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory,
>>> NHibernate.ByteCode.Castle"); to every dialect available to get it to work.
>>> Well don't really need it for all of them but what is needed is to be able
>>> to set this from the configuration pretty much any time I want. I don't want
>>> to have to do this by rebuilding Fluent... Am I right? Left?
>>>
>>> 2009/7/11 James Gregory <[email protected]>
>>>
>>> There's a ProxyFactoryFactory method inside the Database method. Not sure
>>>> what it's doing in there really, but it works.
>>>>
>>>>
>>>> On Sat, Jul 11, 2009 at 6:43 AM, Mikael Henriksson <
>>>> [email protected]> wrote:
>>>>
>>>>> That's the first thing I did but I got stuck on the proxy thing. Inside
>>>>> PersistenceConfiguration.cs I tried to hard code:
>>>>> public TThisConfiguration ProxyFactoryFactory(string
>>>>> proxyFactoryFactoryClass)
>>>>> {
>>>>> values.Store(ProxyFactoryFactoryClassKey,
>>>>> proxyFactoryFactoryClass);
>>>>> return (TThisConfiguration)this;
>>>>> }
>>>>> but I can't see it being called anywhere and it seems to be needed in
>>>>> the next version of NHibernate. My take is that it simply is not
>>>>> implemented
>>>>> yet and I am not sure where to start digging. Bear with me I only played
>>>>> around with this for a couple of days totally.
>>>>>
>>>>>
>>>>> 2009/7/11 Hudson Akridge <[email protected]>
>>>>>
>>>>>> I believe, if you want, you just have to change the SchemaExport line
>>>>>> to:
>>>>>> .Execute(script, true, false, session.Connection, null);
>>>>>>
>>>>>> That should work for NH 2.1+
>>>>>>
>>>>>>
>>>>>> On Sat, Jul 11, 2009 at 12:20 AM, Mikael Henriksson <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> No worries :) I don't mind waiting. Have lot's of code to write
>>>>>>> before I have to worry about that and besides. When Validator get's it's
>>>>>>> hooks in my project I should be able to do a simple:
>>>>>>> new SchemaUpdate(config).Execute(true, true); to refresh the schema.
>>>>>>>
>>>>>>>
>>>>>>> 2009/7/11 Hudson Akridge <[email protected]>
>>>>>>>
>>>>>>>> Ah right, I apologize, I forgot about that. NH2.1 changes the schema
>>>>>>>> export as well as the proxy factory stuff ;) We'll be upgrading to that
>>>>>>>> before too long here I'd imagine.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Jul 10, 2009 at 10:23 PM, Mikael Henriksson <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> There seems to be a problem with SessionSource.cs:
>>>>>>>>>
>>>>>>>>> public void BuildSchema(ISession session, bool script)
>>>>>>>>> {
>>>>>>>>> new SchemaExport(configuration)
>>>>>>>>> .Execute(script, true, false, true,
>>>>>>>>> session.Connection, null);
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> For some reason the last true just before the session.Connection
>>>>>>>>> should not be there anymore and honestly I am not too confident with
>>>>>>>>> NHibernate and Fluent to play around with it too much. I'll just end
>>>>>>>>> up
>>>>>>>>> breaking things. :) I suppose you guys are dead busy with stuff and I
>>>>>>>>> understand that you might want to wait for the final release of
>>>>>>>>> NHibernate.
>>>>>>>>> I think Validator is going to upgrade to that version too later on
>>>>>>>>> but if
>>>>>>>>> someone would have a quick look at it that would be fantastic.
>>>>>>>>>
>>>>>>>>> Cheers
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> 2009/7/11 Hudson Akridge <[email protected]>
>>>>>>>>>
>>>>>>>>>> So if you've got that specified in your hibernate.config.xml file,
>>>>>>>>>> as if you were using NHibernate without FNH, you'd build your
>>>>>>>>>> configuration
>>>>>>>>>> object like you would without FNH.
>>>>>>>>>> Then pass that to:
>>>>>>>>>> Fluently.Configure(nhibernateConfig).etc();
>>>>>>>>>>
>>>>>>>>>> and when you call .BuildSessionFactory() it should pick up on
>>>>>>>>>> that. You could also do a
>>>>>>>>>> .ExposeConfiguration(x=>x.AddProperties(yourProps)) as well I
>>>>>>>>>> believe, but I
>>>>>>>>>> personally find it easier to go with the passing in a NHibernate
>>>>>>>>>> Configuration (which picks up on the hibernate.config.xml
>>>>>>>>>> automatically) to
>>>>>>>>>> the Fluent configure.
>>>>>>>>>>
>>>>>>>>>> There might also be another way to do this that I'm not aware of
>>>>>>>>>> :)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Fri, Jul 10, 2009 at 9:36 PM, Mikael Henriksson <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> I tried both of them. Where is this sent from Fluent to
>>>>>>>>>>> NHibernate? I'll just hardcode it for now.
>>>>>>>>>>>
>>>>>>>>>>> 2009/7/11 Hudson Akridge <[email protected]>
>>>>>>>>>>>
>>>>>>>>>>>> If you rebuilt FNH with the latest version of NHibernate, you
>>>>>>>>>>>> may need to include a hibernate.cfg.xml file with your application
>>>>>>>>>>>> that has
>>>>>>>>>>>> the proxyfactory.factory_class registered with either castle or
>>>>>>>>>>>> LinFu
>>>>>>>>>>>> (doesn't really matter which), then pass that to the fluent
>>>>>>>>>>>> configuration
>>>>>>>>>>>> before you attempt to build a session factory.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Fri, Jul 10, 2009 at 9:16 PM, Mikael Henriksson <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I was because of need to use NHibernate Validator updating the
>>>>>>>>>>>>> NHibernate version to the latest 2.1.3 or something like that.
>>>>>>>>>>>>> Now I get an
>>>>>>>>>>>>> exception saying:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> NHibernate.Bytecode.ProxyFactoryFactoryNotConfiguredException:
>>>>>>>>>>>>> The ProxyFactoryFactory was not configured.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Initialize 'proxyfactory.factory_class' property of the
>>>>>>>>>>>>> session-factory configuration section with one of the available
>>>>>>>>>>>>> NHibernate.ByteCode providers.
>>>>>>>>>>>>> Example:
>>>>>>>>>>>>>
>>>>>>>>>>>>> <property
>>>>>>>>>>>>> name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
>>>>>>>>>>>>> NHibernate.ByteCode.LinFu</property>
>>>>>>>>>>>>> Example:
>>>>>>>>>>>>>
>>>>>>>>>>>>> <property
>>>>>>>>>>>>> name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory,
>>>>>>>>>>>>> NHibernate.ByteCode.Castle</property>
>>>>>>>>>>>>>
>>>>>>>>>>>>> What do I need to do to make it work?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Cheers! :)
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> - Hudson
>>>>>>>>>>>> http://www.bestguesstheory.com
>>>>>>>>>>>> http://twitter.com/HudsonAkridge
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> - Hudson
>>>>>>>>>> http://www.bestguesstheory.com
>>>>>>>>>> http://twitter.com/HudsonAkridge
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> - Hudson
>>>>>>>> http://www.bestguesstheory.com
>>>>>>>> http://twitter.com/HudsonAkridge
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> - Hudson
>>>>>> http://www.bestguesstheory.com
>>>>>> http://twitter.com/HudsonAkridge
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> >>>>
>>>>
>>>
>>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---