Hello
I'm trying out ActiveRecord for the first time and I am having some trouble.
When I instantiate a new model and then call create a record is created in
the database but all the properties are set to null.
Example code:
var person = new Person {Name = "Kevin"};
person.Name = "kevin";
person.Create();
FlushAndRecreateScope();
Person[] people = Person.FindAll();
Assert.AreEqual(1,people.Length);
Assert.AreEqual("Kevin",people[0].Name);
The FlushAndRecreateScope method is from the unit test example at :
http://www.castleproject.org/activerecord/documentation/v1rc1/usersguide/unittesting.html
I've used both sqlite and mssqlce to test with.
My app.config file is as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="activerecord"
type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler,
Castle.ActiveRecord" />
</configSections>
<activerecord
isDebug="true">
<!--
<config>
<add key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider" />
<add key="dialect"
value="NHibernate.Dialect.MsSqlCeDialect" />
<add key="connection.driver_class"
value="NHibernate.Driver.SqlServerCeDriver" />
<add key="connection.connection_string"
value="Data Source=D:\Databases\test.sdf" />
<add key="proxyfactory.factory_class"
value="NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle"/>
<add key="show_sql"
value="true" />
</config>
-->
<config>
<add key="connection.provider"
value="NHibernate.Connection.DriverConnectionProvider" />
<add key="dialect"
value="NHibernate.Dialect.SQLiteDialect" />
<add key="connection.driver_class"
value="NHibernate.Driver.SQLite20Driver" />
<add key="connection.connection_string"
value="Data Source=D:\Databases\test.db" />
<add key="proxyfactory.factory_class"
value="NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle"/>
<add key="show_sql"
value="true" />
</config>
</activerecord>
</configuration>
Also I am configuring the system using the IConfigureSource method:
IConfigurationSource source =
ActiveRecordSectionHandler.Instance;
//ActiveRecordStarter.Initialize(source);
ActiveRecordStarter.Initialize(Assembly.Load("ActiveRecord"),source);
My project's name is ActiveRecord.
If anyone has any insight as to why this would be happening I would love to
hear it!.
Thanks
Kevin Pratt
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" 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/castle-project-users?hl=en.