AdFactum ObjectMapper .NET Blog

Official blog of the AdFactum ObjectMapper .NET

New Release – ObjectMapper .NET 1.45.1129.0

Posted by Gerhard Stephan on December 29th, 2006

This is a minor bug fix release for the connect method of the SqlPersister class. The connect method did not handle the password parameter in all cases and therefore the user could not always connect to the Sql Server.

That’s fixed now. I wish you a successfull new year 2007.


7 Responses to “New Release – ObjectMapper .NET 1.45.1129.0”

  1. Ralf Says:

    Hi Gerhard,

    i am currently looking for persitance frameworks that help me doing O/R mapping and querying stuff. But most of the projects i have examined so far barely support schema changes and they usally dont care about migration tasks a all.

    Due to that your framework is able to create a logical schema in the database, i tried it out but i cannot build the project! (fyi: WINXP SP2, VS 2005) There is a Oracle library missing.

    Is there possibility to compile without Oracle support? (I like to use MS SQL Express for testing) Hacking your code is not my prefered option.

    And second: How would your system handle changes on the applications datamodel? Are they reflected to DDL operations somehow?

    — Ralf

  2. Gerhard Stephan Says:

    Hi Ralf,

    you don’t need to build the ObjectMapper .NET for VS 2005. There’re already compiled versions of the ObjectMapper .NET for 2003 and 2005 included in the distributed zip file.

    If you’re only using the ObjectMapper .NET, you do not need to have Oracle installed at your PC.

    If you want to build the ObjectMapper .NET project itself (which you don’t need), you’ll have to install the Oracle Driver. MS SQL Express is already supported – you have to use the SqlPersister for that case.

    To your question: You can output a dif script that reflects the changes to your datamodel regarding the database you’re currently using. The Persister class owns a method called ‘WriteSchemaDif’ which does this for you.

    Hope I could help you


  3. Ralf Says:

    Thanks for the quick reply! I tried again and it worked out this time.

    I did some testing with the ‘WriteSchemaDif’ method and it’s working too. Defining new properties in my business classes brings up new columns in the table like expected. So far so good. But removing a property (just by changing the ‘PropertyName()’ attribute) failed because of some conflicting constraint:

    > Das Objekt-Objekt ‘DF__FOOBUSINESS__XXX__023D5A04’ ist vom Spalte-Objekt ‘XXX’
    > abhängig. Fehler bei ALTER TABLE DROP COLUMN XXX, da mindestens ein Objekt auf
    > diese Spalte zugreift.

    Is this solvable without effort?

    What i want to do in the future is to change the application model at *runtime*. Using an class-introspection object-mapper like yours, this implies creating classes via the reflection api and feed it to the persitance layer like common classes. Tricky hacking in my opinion.

    Is this possible at all? Or could i instead make use of some data structures your framework is operating with after having analysed the entity classes?

    — Ralf

  4. Gerhard Stephan Says:

    Hi Ralf,

    first of all: Database migration is a big task. So it can’t be automated at all. I don’t know any tool which can handle the semantic of data migration. Think about renaming a column like you do in your example. The ObjectMapper is going to remove the old column and add a new coloumn, but renaming it would be sufficient. That’s why the ObjectMapper .NET does not retrospective change all dependent constraints, because there’s always a manual effort in migrating the data.

    About your second question: I would strongly recommend not to change a physical database model at runtime. That’s the worst way you can go.

    Think about an entity model that is variable enough to store all your data. I don’t know any cases where you would need dynamically database migration at runtime. Try to explain your use case.


  5. Karl Says:

    ‘About your second question: I would strongly recommend not to change a physical database model at runtime. That’s the worst way you can go.’
    I strongly agree with gerhard. Dynamic driven systems lack in stability and are hard to maintain.


  6. Ralf Says:

    Hi Gerhard, hi Charles,

    i agree that migration is a big task. And i further agree with the fact that it cannot be automated completely. This is because of data semantics that are simple not covered by any data model. So you might have got me wrong on how i intend to use a O/R mapping framework.

    It’s not that i want to change a datamodel while some applications run it. This is not desireable because it would simply break those applications. It’s just about that schemas change over time and undergo some model-evolution…

    Sorry for the following ‘introduction’ but i want you to know what i am actually talking about, so:

    Think about entity/class-centric datamodels, created with some common uml-modelling tool, that are translated into any arbitrary DDL (might be SQL). This is where some O/R mapping happens, right? Ok. Now think of changing that base model. Again, we have to do mapping and translating, but now we might have migration issues too! Not automatically solveable as we know. So if its not automatic it must manual. The model designer therefore must be provided with some model/language expressions to describe the needed migration paths. Translating the model to a DDL description now comprises execution of DML operations – as described by a migration path – through an migration tool.

    And here we go. I am simply about to develop such a migration tool. But as there is a lot of O/R mapping involved, i just thought about using an O/R framework to reuse CRUD and querying stuff.

    As this is apparently a bit beside of the usual set of O/R mappers use-cases, it may have been the cause of confusion. Sorry if so.

    I hope i have made myself clear now. But thank you for still replying to my posts! 😉

    — Ralf

  7. Gerhard Stephan Says:

    Hi Ralf,

    now I understand. Thanks for your explanation.

    At the moment the WriteSchemaDif does not support removing constraints. This task is not easy to handle, because you have to delete the constraints in a sorted way to avoid constraint violations.

    Maybe I’m going to put this task onto my todo list, but I can’t promise you to implement it.

    So I think you have to implement that task by your own, if you need a quick solution for the problem.

    Hope I could help you


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>