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
|
Is that possible to use multiple context for dynamic data? My project got 3 models and I can't use ASP.Net dynamic data. "No unit of work query property found" exception occurs. |
|
|
It looks like you can do this calling MetaModel.RegisterContext several times:
Note that because LightSpeedDataModelProvider requires a strong-typed LightSpeedContext, you will need to create multiple LightSpeedContexts, one for each unit of work type (in this case, Logistics and Wildlife). Please note we have not formally tested this setup but it seems to work in a quick test -- we'd be interested to hear how you get on. |
|
|
Thanks for your quick reply. I already tried your method, but I still get the error. |
|
|
Okay, I am not sure why it is working for me and not for you, but if that technique doesn't work, you'll need to create a combined unit of work type and use that (I'm assuming all three models back onto the same database; if not, you won't be able to do this). E.g.
|
|
|
We have 3 models representing 3 different databases. Do you know what the underlying issue is? Maybe we can find a work around. I'd like to avoid something like using Areas or separate admin projects for each model/db. |
|
|
The underlying issue is that we are trying to find the metadata for the target entity type of an association, and we are unable to locate that entity type in the model. This looks only within the types defined in the same model. The error you described could occur if you have somehow created an association across models -- something that would not work at the LightSpeed level but could happen if you have manually implemented a wrapper property of entity type. The error message is telling you the target type that we were unable to find. Do you have any cross-model properties of that type? |
|
|
Yah there are. Should these properties be marked with an attribute to let LS know to ignore them, such as Transient? |
|
|
TransientAttribute can only be applied to a backing field, not a property, and since these are cross-model associations I am guessing there isn't a backing field for them. Looking at our dynamic data code it looks like there is no way to exclude a property from being represented, so the only way to avoid this problem is to convert the properties to methods -- which obviously you won't want to do because of the impact on the rest of the codebase. So I think we are going to need to provide you with an update so that you can exclude the problematic property. I'm thinking that [ScaffoldColumn(false)] is probably the best attribute to use to exclude properties from Dynamic Data; does that work for you? |
|
|
Yah that works for us, thanks. Maintaining these associative properties manually is perfectly fine since they shouldn't actually be mettled with manually. I appreciate the quick response. Will this be in the build tonight or the next few days? |
|
|
It will be in tonight's build. Let us know if you still see problems! |
|
|
Thanks Ivan, just letting you know it works as expected. |
|