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
|
Hi, I created an implementation of the IDisplayNamingStrategy interface, created an instance of that implementation and assigend it to my LightSpeedContext instance. I expected that the GetDisplayName(...) will be called during formating an validation error. But that didn't happened. Regards, |
|
|
You got the concept right, so this sounds like a bug. Can you provide us with a simple, minimal repro? Thanks! |
|
|
Hi Ivan, have a look at the Bootstrapper.TestDisplayNamingStrategy(). Regards, |
|
|
Your entity is not associated with your LightSpeedContext. In order for LightSpeedContext settings, such as DisplayNamingStrategy, to take effect, you must load the entity into a unit of work. Note also that unique validation requires a unit of work, since it must issue a database query. The unique validation on Name will be skipped in your test code because there is no unit of work to provide a connection for the uniqueness query. |
|
|
Thanks for the clarification. |
|
|
This is not going to work for me properly. The whole Context/UnitOfWork is abstracted behind my application services. At the UI level I want to have basic entity valdiation (required properties, type and length checks), that fails fast without hitting the infrastructure layer. At the application and domain Layer I have the UOW and there is where I want to perform the more extended validations (for example the unique checks). With the current solution I need to go through the whole stack to get the display names for simple required property checks. Is it possible to get a global (static?) point (regardless of any Lightspeed Context) where I can set the strategy? May be you check first if there is a strategy associated at the current entity, if not check if there is a global strategy and use that? Kind regards, |
|