I'll fix this shortly.
--
---
You received this message because you are subscribed to a topic in the Google Groups "nhibernate-development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/nhibernate-development/aIGssJRjHcw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
Hi Jeffrey,
one thing I don’t quite understand is why do you want to write Migrations by hand while NHibernate already has all the Information you need for letting some sort of a framework do this automatically?
We already tell NHibernate what Tables and Columns are needed in terms of mappings.
I mean why not just read the mappings, extract the Schema from them and then let some framework do the rest without having to say things like Create.Table(…) etc.?
Let me rephrase my Question:
What are the benefits of your migrations framework compared to – let’s say – FluentMigrator?
Amro
To unsubscribe from this group and all its topics, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
FluentMigrator is also db independent and I'm actually using it since some time to generate the schema for NHibernate.
What would truly be awesome is a framework which would inspect the mappings of nhibernate and automatically executes the appropriate operations against FluentMigrator (or any other migration "engine") to generate the schema.
This shouldn't require any changes to nhibernate and if you're going down that path you already have at least one volunteer :)
I don't know how others see this but my own opinion is that schema generation shouldn't be a responsibility of nhibernate at all.
And I'm saying this although I really like your concept of DdlOperation and the related code is much cleaner than what was there before!
Amro
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to nhibernate-development+unsubscri...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsubscri...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsubscri...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
There is no need to read XML files or interpret mapping-by-code stuff.
All of the required mapping information ends up in PersistentClass which is exposed in Configuration through the Enumerable Property ClassMappings if I remember correctly.
Take a look at the implementation of IterateGenerators in the Configuration class (the last method in Configuration.cs).
It shows how to get hold of identifier generators.
As for auxiliary objects the easiest way I can ad hoc think of would be to subscribe to one of the Events BeforeBindMapping or AfterBindMapping of Configuration.
Both events gets HbmMapping as a property of the argument BindMappingEventArgs.
In the event handler you just iterate over HbmMapping.DatabaseObjects.
I won’t overestimate the importance of auxiliary objects though.
Von: nhibernate-...@googlegroups.com [mailto:nhibernate-...@googlegroups.com] Im Auftrag von Jeffrey Becker
Gesendet: Montag, 16. Februar 2015 14:26
An: nhibernate-...@googlegroups.com
Betreff: Re: [nhibernate-development] Re: Migrations Status & Feedback request
I did look into using the PersistentClass property but that doesn't seem to include information about identifier generators or auxiliary db objects. My first thought with this was to simply spider configuration and spit out a fluent migrator based class. I went down the whole operations framework path after concluding that all the mapping information I needed just wasn't available.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
1) A PersistentClass holds a couple of Property iterators. I would first try “SubclassPropertyClosureIterator” (but I’m not really sure!).
Each Property instance holds a collection of Column objects called “ColumnIterator”.
To get the type of a column you just call: column.GetSqlTypeCode(mapping).
You get that “mapping” argument by calling BuildMapping() on a Configuration instance which you should do before accessing ClassMappings for the first time.
Here is a pseudo code example:
var mapping = nhConfiguration.BuildMapping()
foreach(var pc in nhConfiguration.ClassMappings)
{
foreach(var property in pc.SubclassPropertyClosureIterator)
{
foreach(var col in property.ColumnIterator)
var dbType = col.GetSqlTypeCode(mapping).DbType
}
}
2) As far as I can tell, the only true black box identifier is TableGenerator.
If I’m not completely mistaken the rest should be accessible through PersistenceClass.IdentifierProperty.ColumnIterator
Amro
Von: nhibernate-...@googlegroups.com [mailto:nhibernate-...@googlegroups.com] Im Auftrag von Jeffrey Becker
Gesendet: Dienstag, 10. März 2015 19:40
An: nhibernate-...@googlegroups.com
Betreff: Re: [nhibernate-development] Re: Migrations Status & Feedback request
Amaro, I started going down the path you suggested and I'm running into some pretty big road blocks.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
Jeffrey,
I would say that it looks good to my eyes in terms of pure schema extraction.
But this won’t work if you’re going down the path of determining changes in mappings and then automatically create migration expressions!
You will need to track entity and property mapping changes and thus extract the schema out of both not just the table associated with an entity.
For example, PropertyX mapped to ColumnX and then changed to ColumnY. You won’t be able to detect that this needs an alter column expression unless you extract the schema out of PropertyX.
We can work on this together if you are interested. Do you have a public repo for this?
Von: nhibernate-...@googlegroups.com [mailto:nhibernate-...@googlegroups.com] Im Auftrag von Jeffrey Becker
Gesendet: Mittwoch, 11. März 2015 18:24
An: nhibernate-...@googlegroups.com
Betreff: Re: [nhibernate-development] Re: Migrations Status & Feedback request
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-develo...@googlegroups.com.
Amaro,
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhibernate-development+unsub...@googlegroups.com.