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 am trying to get Lightspeed 3.0 working with an ASP.NET Dynamic Data project and have two questions regarding the IdentityMethod. 1. Why isn't their a way to set the IdentityMethod for the entire model in the designer? In reading previous posts I found where it can be set for each entity (using the nightly build version of Lightspeed). If it's appropriate to allow setting it at the entity level, why not at the model level. 2. In reading the documentation for Identity Generation it says "Identity generation is set on the LightSpeed context, either in code or by using the LightSpeed configuration section in the .config file for your application." It then gives an example for setting it in code but not .config. How do you set it in .config. Thanks Steve |
|
|
1. Because the IdentityMethod is generally set at a context level at runtime. The only reason we allow setting it at the entity level is for legacy databases where there is a mix of identity strategies, e.g. some tables use client-assigned integer IDs, some use database-assigned integer IDs, and some use GUIDs. In general you should not set the Identity Method on an entity unless it behaves differently from the rest of the database. 2. Add the following attribute to the lightSpeedContexts/add element: identityMethod="KeyTable" <!-- or "Sequence" or "IdentityColumn" or whatever --> See Help Topics > LightSpeed > Configuration in the docs for more info and examples. |
|
|
1. I'm wondering why you would choose to have the IdentityMethod something that you have to set at runtime. I wouldn't thing that once the model is created it would vary. Am I missing something here? 2. Thanks. I simply missed that in the documentation. |
|
|
No, you're not missing anything here -- it's basically a quirk of the different ways of specifying identity methods. Table-level identity methods are specified in entity class code: the designer controls that code, so it can emit table-level identity methods. Context-level identity methods are (for a combination of reasons, some technical, some historical) specified in LightSpeedContext setup code or in configuration, which the designer *doesn't* control (again, for a combination of reasons). So conceptually you're right that for most scenarios the identity method could be set at design time, and I agree it would be nice to offer that option; but in practice it turns out not to be possible because of this quirk of where the "global identity method" code would have to be emitted. Hope this makes a kind of sense now! |
|