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
|
I downloaded the latest nightly build yesterday. This morning I have made some changes to the database and I want to update the model in the designer. This used to be possible by right-clicking in the designer - but I can't find the option for doing this anymore? Has this been removed or relocated somewhere else? I certainly hope it hasn't been removed as it is a very useful feature - I don't want to have to remove and re-add the changed tables as this will also remove all the documentation for them :-(
Craig |
|
|
No, it hasn't been removed or relocated -- we understand this is a core feature for our users and we wouldn't do such a thing lightly! We have occasionally seen glitches in the designer after an upgrade -- we have a known issue when upgrading from RTM to a nightly but we also hear the odd unconfirmed sighting of glitches after a nightly-to-nightly upgrade. Could you try doing a full uninstall of LightSpeed and then a full reinstall please? Also please verify in Control Panel > Add/Remove Programs (or whatever it is called this week) that there is only one entry for LightSpeed in the list -- glitched upgrades sometimes leave Windows thinking there are two versions on the system, in which case be sure to uninstall both (even though one doesn't exist!) before reinstalling. If reinstalling doesn't fix it, let us know and we'll investigate further. |
|
|
Hi Ivan, I un-installed and re-installed again, still not working :-( I checked Add/Remove Programs and there is only one entry there. I have e-mailed you a screenshot of what I am seeing, just to make sure I'm not looking at the wrong area.
Craig |
|
|
Can you check the connection string (click the model background and look for Connection String in the Properties window -- under Roundtripping if in category view) please? The menu in your screenshot is what you'd see if there's no roundtrip database connection configured for the model. |
|
|
Thanks Ivan, That was the problem. When we drag views onto the designer, is this property set automatically? I don't remember setting it the other times I've used the designer.
Craig |
|
|
LightSpeed sets the connection string when you drag a table onto the model. I have to admit I've not tested it with views or stored procedures; there might be a bug there, sorry. |
|
|
That might be the problem - I was only working with views.
Craig |
|
|
I installed the first time Nightly Build for 24 Jul 2010 - LightSpeed31Express-20100724.msi on VS2010 Pro on windows 7 Ultimate 64 bit. I want to do the model-first approach and after I did my models I want to make a roundtrip mapping with my non- yet-existing database so it must be check if it exists, if yes update all tables, if not create the database. I totally miss that super uselful feature. Please add this as a feature request if its not hidden beyond a button I have overlooked... |
|
|
hm yeah I really found the butto "Update Database", right-click on the title of the entity just like in EF afair...
|
|
|
Hello Bastien, As you've found, you can do the "update all tables" thing by right-clicking on the model and choosing Update Database, or update the table for a particular entity by right-clicking on the entity title and choosing Update Database. We haven't previously supported creating the database if it doesn't already exist, but I've added support for this beginning in the 27 July nightly build (which will be available from about 1500 GMT). This is currently limited to SQL Server 2005/2008, MySQL and PostgreSQL. (SQLite already auto-creates the database file if it doesn't exist, and Oracle requires a special DBA session to perform database creation. If you need this on another database engine then let us know.) Obviously, to use this feature you'll have to type in the connection string manually rather than initialising it by dragging a table onto the designer. The Update Database command doesn't appear until a connection string and database provider are specified. We welcome feedback on this feature, and of course please let us know if you run into any bugs. |
|
|
"We welcome feedback on this feature,..." Word... I tried this feature 7 months later now on SQLite 3 and LS 3.11. When I do Update Database from my Model I get this: I have my SchoolclassCode not set with Int64, why this error message? Or the duplicate name PupilId, there is no such a name just Pupil association has Key Property Reference set to: Id.PupilId but this is your advise here: http://www.mindscapehq.com/blog/index.php/2010/06/17/many-to-many-associations-and-composite-keys-in-lightspeed/ About the rest I have to ask a new question because your code samples differentiate from your blog posts concerning many to many/associations so something is not working on my side... |
|
|
Re SchoolclassCode: It looks like the Id column in the database is defined as a bigint, but the Identity Type in LightSpeed is defined as Int32. So LightSpeed wants to change the Id column in the database to a (32-bit) int, but we cannot alter column types in SQLite. Re PupilId duplicate column: I can't be sure because the screenshot is clipped, but it looks like PupilDocument has both an explicit PupilId property and a Pupil association. The Pupil association automatically results in a PupilId property (you say you have set its Key Property Reference to Id.PupilId, but I don't see any identity properties on PupilDocument, so Id.PupilId doesn't exist). Therefore you have two PupilId properties on PupilDocument, hence the duplicate column error when LightSpeed tries to create them. Remove the explicit PupilId property: you don't need it. (Alternatively, if you want to use a natural key, remove the PupilId property, create a new identity property called PupilId, and set the Pupil association's Key Property Reference to Id.PupilId. You'll need to do the same with DocumentId and the Document association. Note you must create an identity property if you want to suppress the normal surrogate key.) |
|
|
Ok the explicit PupilId and DocumentId is removed. Funny that the error did not say DocumentId too.
My database has no table therefore they can not be an Id column with type bigint !!! ???
I had a table SchoolclassCode but deleted it. Seems LS somehow don`t get synced right? When I say Update from Source all my entities dissapear in the designer and ONE SchoolclassCode entity is suddenly created. Funny from where does LS know of this table? Its removed ... |
|
|
I'm not sure what has happened regarding removal of your SchoolclassCode table but clearly there is something still there. LightSpeed doesn't "remember" tables that previously existed: when you do an Update, it queries your database schema afresh and compares it to the model. So if something is "remembering" the table then it is within SQLite itself. I guess do a Refresh in Server Explorer and make sure the table was successfully deleted...? |
|
|
I did a refresh multiple times restarted even Visual Studio, same error.
Another odd thing is that when I set Identity Method on every Entity to IdentityColumn and do Update DataBase the error says:
Can`t create Identity/Auto inc columns on this database... Well well well... Now the killer question, should it be possible at all to make an Update Database on a sqlite database? |
|
|
That is correct. You have specified the entity identity method as Identity Column, which means the database Id columns need to be specified as identity/autoincrement. We don't currently support creating autoincrement columns on SQLite (only on MySQL and the SQL Server family). I'll look into whether we can add this capability for SQLite. As to "should it be possible at all to make an Update Database on a SQLite database?" -- yes, it should. However, SQLite is a problematic database for Update Database, because there are quite a few things it doesn't do (or does in a way that is hard for us to support). The LightSpeed default settings (surrogate keys, KeyTable identity, etc.) generally work well. There are some things, though, that don't work on SQLite because the database just doesn't support them (e.g. altering the data type of a column). And as with most things in LightSpeed, the further you diverge from the LightSpeed conventions (e.g. composite keys, identity columns, etc.) the more likely you are to run into limitations. That said, given your emphasis on the storage model, I think model-first and Update Database may not be the right approach for you. You may find it more congenial to use a database design tool to create your schema, then use drag-and-drop and Update From Source to create a LightSpeed model from that. I think this will make for more work in the end than model-first and going with the LightSpeed defaults, but it may be worth considering. Thanks for looking further into that issue with the phantom table. Unfortunately, I'm afraid I'm baffled! LightSpeed is not 'remembering' that table: something inside SQLite is telling us that it's there and we have to accept what SQLite tells us. If you want to send us the SQLite database file then we can try to investigate though! |
|
|
ok thank you ivan I really appreciate that you write so much - hey don`t you have some features to code? - ;-)
Really the SchoolclassCode table did NOT exist! The prove was when I did Update from SOURCE then all my tables were removed including the SchoolclassCode entity. I will show you something concerning SQLite/SQL CE 4.0 and Auto INC columns =>
"Support for the code-first and for the server-generated keys rounds out the Compact support for ADO.NET Entity Framework and fulfills one of the main asks from the development community." The identity column for SQL CE 4.0 was afair the posts on msdn forum the biggest wish from user. They did not want to fumble around with Guid`s in code what I do everyday and I curse it... So if you implement for SQLite3 an auto inc in your Lightspeed I think many will like it. SQLite 3 has auto inc support so you should be able to implement it I guess. |
|
|
btw. in which way does the support from LightSpeed vary concerning SQLite3 and SQL CE 4 ? That would really be interesting to hear! |
|