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
|
Hy, I'm trying to make a simple ASP.NET binding with a LighSpeedLinqDataSource to a asp Gridview. This works fine... But if i enable "automatic update", and try to update the data, i get the following error: Object reference not set to an instance of an object. If its possible, can u tell me how to make this correctly? I hope this works somehow, if not, it would be a great improvement for the next version. Im missing the Web Support for your product a bit... Some Screencasts where u make a Website instead of a Concole Application would also be nice :)
thanks David |
|
|
Hi David, I'm sure I'm being dumb here, but I'm not sure what you mean by enabling automatic update. I've had a look through the properties for both GridView and LightSpeedLinqDataSource and haven't been able to identify an "automatic update" option. Could you provide us with a detailed walkthrough of the steps you took, or a project that reproduces the problem? (You can attach a zip file via the Options tab.) Thanks! |
|
|
Ok, well..what i did: 1) Make a new ASP.NET 3.5 Dynamic Data Project 2) Make new Model item, register it in Global.asax and the rest of these steps: http://www.mindscape.co.nz/help/ls20/Help%20Topics/Web%20Tools/DynamicData.html So, now i should be able to run the site. But as soon as i click on my Table, i get an error Then i've tried to make a Site with a Gridview and a LightSpeedLinqDataSource (btw: there is a property on the Gridview: "AutoGenerateEditButton", if this is true, u can enable "EnableUpdate" on a normal LinqDataSource, and then u can make automatically updates without any code) but I'm not sure if this is possible with your datasource -> if not, hopefully soon :) i attached my project so that u can look at it yourself |
|
|
Hi David, Try updating your gloabl.asax code behind from this: public static readonly LightSpeedContext<LightSpeedModel1UnitOfWork> DataContext To this: public static readonly LightSpeedContext<LightSpeedModel1UnitOfWork> DataContext = new LightSpeedContext<LightSpeedModel1UnitOfWork>("Development"); I think we need to improve the documentation for the Dynamic Data to state that you need to create the context, not just declare it. Let me know if that resolves your issue. John-Daniel Trask |
|
|
Thanks a lot! It works now! But i've got some other questions/bugs i want to talk about: 1) I just saw, that if a Field in the DB is set to ALLOW NULLS, i get javascript errors on the Page 2) Why don't i see the change of ALLOW NULLS true/false when i synchronize my Class with the DB`? 3) How about Default Values? i was annoyed of LINQ-TO-SQL when i had in my db fields with ALLOW NULL = true and default value like getdate() and made an insert where i didnt set this field, i get an error.
david |
|
|
1. This was a bug in the RTM of 2.2. It should be fixed in current nightly builds. If you still see the problem with the current nightly, please let us know -- thanks! 2. This is a known limitation of the synchronisation algorithm at the moment, I'm afraid. It is on the list to implement but other things have taken priority. If it's a significant concern for you then let us know and we'll try to bump it up the list! 3. Can you clarify what you are seeing here (and what you consider to be the expected/desired behaviour)? Are you saying that if there is a default value defined in the database, but the column is nullable and the LightSpeed property is set to null, the column is being set to NULL? Or to the default value? Thanks! |
|
|
Point 1) works now, thanks :)
with point 3 i mean: i have a 2 Fields in the DB, one is allow nulls = false and defaul value getdate(), the other is allow nulls true. Now, if i make a new Entry, like that: Project proj = new Project() and add it, i get an error, that the other field doesnt allow null, even i have set the default value. So my question: Is it possible that Lightspeed automatically detects the default values set in the DB, and uses them? regards david |
|
|
Thanks for the clarification. No, LightSpeed does not detect the default values set in the database. We would recommend that default values be set in the domain model, i.e. the entity class, for example by setting an initial value in the entity constructor -- we tend to feel that this kind of thing is logically part of the domain model, not the persistence mechanism (the database). |
|