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" <markus.zywi...@gmail.com> 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 <don...@gmail.com>: > > > > > 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" <markus.zywi...@gmail.com> wrote: > >> ActiveRecordStarter.CreateSchema(); > >> ActiveRecordStarter.DropSchema(); > >> ActiveRecordStarter.UpdateSchema(); > > >> 2009/1/8 Mark Jensen <don...@gmail.com>: > > >> > 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" <markus.zywi...@gmail.com> wrote: > >> >> You have to recreate the schema. It creates a table to store the next > >> >> hi to use. > > >> >> 2009/1/8 Mark Jensen <don...@gmail.com>: > > >> >> > 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" <markus.zywi...@gmail.com> 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 <don...@gmail.com>: > > >> >> >> > 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" <markus.zywi...@gmail.com> > >> >> >> > wrote: > >> >> >> >> Do you use MSSQL Identity for your PKs? > > >> >> >> >> -Markus > > >> >> >> >> 2009/1/8 Mark Jensen <don...@gmail.com>: > > >> >> >> >> > 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" <markus.zywi...@gmail.com> > >> >> >> >> > wrote: > >> >> >> >> >> 2009/1/8 Mark Jensen <don...@gmail.com>: > > >> >> >> >> >> > [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 castle-project-users@googlegroups.com To unsubscribe from this group, send email to castle-project-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en -~----------~----~----~----~------~----~------~--~---