Thanks, I read that... but I dont understand the Paramter in the CreateSchema()
anyway...it is not the ID on Post that is the problem.. it is the BlogID on Post that is empty after I persist Blog with Blog.Save(). On Jan 9, 3:00 pm, "Markus Zywitza" <[email protected]> wrote: > schema > generation:http://www.castleproject.org/activerecord/documentation/trunk/usersgu... > > When you create a new Post, it's ID is Guid.Empty. That's just fine, > as this is the unsaved value. When the post is saved and flushed, it > is assigned an Guid generated by NH. > > -Markus > > 2009/1/9 Mark Jensen <[email protected]>: > > > > > I have switched over to Guids (GuidComb) instead.... > > > Now the foreignkey in Post is just guid.empty :/ when I create a new > > Blog and add a Post to it. > > > On Jan 9, 1:19 pm, "Markus Zywitza" <[email protected]> wrote: > >> Here is my setup/teardown: > > >> [SetUp] > >> public void Setup() > >> { > >> ActiveRecordStarter.Initialize( > >> ActiveRecordSectionHandler.Instance, > >> typeof(SubjectUnderTest), typeof(OtherNeededTypesForTest)); > >> ActiveRecordStarter.CreateSchema(typeof(ActiveRecordBase)); > >> } > > >> [TearDown] > >> public void Teardown() > >> { > >> ActiveRecordStarter.DropSchema(typeof(ActiveRecordBase)); > >> ActiveRecordStarter.ResetInitializationFlag(); > >> } > > >> The typeof(ActiveRecordBase) in Create/Drop is necessary to keep AR > >> from modifying the schema on other databases than the primary > >> testdatabase. > > >> -Markus > > >> 2009/1/9 Mark Jensen <[email protected]>: > > >> > anyway, if i leave out the update method I get the following exception > > >> > "Dialect does not support identity key generation" > > >> > On Jan 8, 8:50 pm, "Markus Zywitza" <[email protected]> wrote: > >> >> ActiveRecordStarter.CreateSchema(); > >> >> ActiveRecordStarter.DropSchema(); > >> >> ActiveRecordStarter.UpdateSchema(); > > >> >> 2009/1/8 Mark Jensen <[email protected]>: > > >> >> > recreate? how > > >> >> > Atm I running the thing in a unittest where I do the following > > >> >> > XmlConfigurationSource source = new XmlConfigurationSource("../../ > >> >> > AppConfig.xml"); > >> >> > Assembly asm = Assembly.Load("myDomain"); > >> >> > ActiveRecordStarter.Initialize(asm, source); > > >> >> > On Jan 8, 4:10 pm, "Markus Zywitza" <[email protected]> wrote: > >> >> >> You have to recreate the schema. It creates a table to store the > >> >> >> next hi to use. > > >> >> >> 2009/1/8 Mark Jensen <[email protected]>: > > >> >> >> > When I switch my primarykeys on Blog and Post to HiLo I get the > >> >> >> > following error > > >> >> >> > System.Data.SqlClient.SqlException: Invalid object name > >> >> >> > 'hibernate_unique_key'. > > >> >> >> > On Jan 8, 3:51 pm, "Markus Zywitza" <[email protected]> > >> >> >> > wrote: > >> >> >> >> GuidComb is nearly as fast as Identity. With AR/NH its even faster > >> >> >> >> because Identity requires NH to hit the DB when you call Save() > >> >> >> >> instead of flushing all at once. This also has side effects to > >> >> >> >> cascading, what is why I asked. > > >> >> >> >> If you need numerical IDs, use HiLo instead. You can quick try > >> >> >> >> this > >> >> >> >> without changing your classes to see whether cascading works as > >> >> >> >> expected without Identity PKs. > > >> >> >> >> -Markus > > >> >> >> >> 2009/1/8 Mark Jensen <[email protected]>: > > >> >> >> >> > Atm, yes.... > > >> >> >> >> > I haven't really dicided if I shoud go with Identity og > >> >> >> >> > Guids.... I > >> >> >> >> > have choosen Identity so fare, because i believe it to be > >> >> >> >> > faster.. > > >> >> >> >> > On Jan 8, 3:46 pm, "Markus Zywitza" <[email protected]> > >> >> >> >> > wrote: > >> >> >> >> >> Do you use MSSQL Identity for your PKs? > > >> >> >> >> >> -Markus > > >> >> >> >> >> 2009/1/8 Mark Jensen <[email protected]>: > > >> >> >> >> >> > BTW. when I Add a new Post the BlogID is zero when I persist > >> >> >> >> >> > this way > >> >> >> >> >> > Blog.Save(); > > >> >> >> >> >> > On Jan 8, 3:18 pm, "Markus Zywitza" > >> >> >> >> >> > <[email protected]> wrote: > >> >> >> >> >> >> 2009/1/8 Mark Jensen <[email protected]>: > > >> >> >> >> >> >> > [HasMany(typeof(Post), > >> >> >> >> >> >> > Table = "Posts", > >> >> >> >> >> >> > ColumnKey = "BlogId", > >> >> >> >> >> >> > Access = PropertyAccess.NosetterCamelcase, > >> >> >> >> >> >> > RelationType = RelationType.Bag, > >> >> >> >> >> >> Inverse = true, > >> >> >> >> >> >> > Cascade = ManyRelationCascadeEnum.SaveUpdate > >> >> >> >> >> >> > )] > >> >> >> >> >> >> > private IList<Post> PostList > >> >> >> >> >> >> > { > >> >> >> >> >> >> > get { return postlist; } > >> >> >> >> >> >> > } > > >> >> >> >> >> >> -Markus --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
