This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hello, I've been searching if it's possible to generate a DB (or update one) from a set of entities (.cs files) via C# code. I have read the documentation and browsed a little the forums, but this is the only thing I have been able to find: http://www.mindscape.co.nz/forums/Thread.aspx?PostID=4471 So I suppose this is not currently possible, but would it be possible in the future? Regards, Vicente |
|
|
Hi Vicente, The LightSpeed designer can generate databases based on entity classes however these need to be LightSpeed entity classes - not some random C# classes. You can drag and drop on entities, relationships, inheritance structures and more with the LightSpeed model designer and then use that to generate a database schema for you. I think you're wanting the ability to generate a database from an ad-hoc collection of classes, not LightSpeed entity classes, correct? Please let me know if I have misunderstood your question. I hope that helps, John-Daniel Trask |
|
|
Hi John-Daniel, I expressed myself pretty badly I think: in our current project we have a collection of LightSpeed entity classes, and the end user has to be able to generate a new DB pressing a button. We thought that maybe it would be possible to generate this DB using Mindscape via C# (no designer, it has to be done by code). But I have been unable to find anything about this (so I'm walking the "write a very long and boring SQL script" path...). Is it possible to do this? If not, is it planned for the future? Regards, Vicente |
|
|
Hi Vicente, Thank you for your clarification :-) Are the entities ever likely to change, or is this just to initialise a database the first time for a user? If it's just a once off you might be best to create a SQL script but we can help with that. Using the Migrations capabilities of the designer, you can create an initial migration of your model and then from the Migrations menu, elect to have it generate a SQL script for you. This will save you having to create it manually. Alternatively, create a migration to get your database into a state that matches the model and then you can have your application run lsmigrate.exe and build the database from those migrations. We have a customer who is doing this already. Will that help your situation at all? I hope it does help, John-Daniel Trask |
|
|
Hi John Daniel, sorry for my late answer. I've tried going the migrations path, but I'm using VistaDB and the migration says that dropping a table is not supported on that provider. I have tried also using an empty Down method and what happens is that I get an empty script that only says: "-- Migration 20100107225803 - Down I have tried to run the migration on an a database without any table and on our full database, but the script returns the same in both cases. Any idea on what can be happening? (probably I'm doing something wrong, I don't really understand very well what it's happening). Regards, Vicente |
|
|
Vicente, Thanks for your forum post. I will have a look at the VistaDB migrations code and look at enhancing it - sorry about that. I will post an update here once I have made some changes. Kind regards, John-Daniel Trask |
|
|
To update, I have added some additional support for VistaDB migrations. You should now have no issues:
They all needed to have support added and will be available in the next nightly build dated the 13/01/2010.
I hope that helps and thank you for reporting this. Please let me know if you have any additional issues with the new nightly build.
John-Daniel
|
|
|
Thanks a lot John-Daniel, as usual your customer support is top-notch :) Regards! Vicente |
|