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 it possibly to change !Uri.TryCreate(validationContext.TargetValue.ToString(), UriKind.Absolute, out uri)) to Uri!Uri.TryCreate(validationContext.TargetValue.ToString(), UriKind.RelativeOrAbsolute, out uri)) in UriValidationRule.cs |
|
|
Hi Christian, Ignore my previous post on the subject :-) I've added this support. Rather than just change the rule which could potentially harm existing LightSpeed users as the behavior of the validation rule would change, I have implemented a parameter that can be passed into the attribute to dictate the uri type. Starting from tomorrow you should be able to write: [ValidateUri(UriType = UriKind.RelativeOrAbsolute)] Without providing the UriType parameter the validation will default to Absolute - the current behavior. I hope this helps, John-Daniel Trask |
|
|
Nice :-)
But the reason for the request is that the codegen.exe is marking all columns with name Url with [ValidateUri] I think perhaps I have to make some changes in the templates... |
|
|
That stuff is happening before it gets to the templates -- the attributes are being inferred from the database schema when we assemble the abstract model, and the template just dumbly regurgitates the attributes collection. I am not sure how easy it would be to provide special handling at the template level for a particular attribute (you would probably need to do a GetType() to identify the type you want to give special handling to). We could provide a flag to turn off attribute inference but that would leave you with no validation at all, which I'm guessing would be just as bad. Fundamentally the problem is that the database simply doesn't contain enough information for us to figure out what validations are appropriate. So I'm not really sure how to improve this for you (short of a fairly substantial effort to support some kind of "supplementary metadata" file) -- open to suggestions! |
|
|
I'm using Codesmith a lot, and I have some Codesmith templates for Lightspeed that is doing the mapping to "Model optimize for Ajax"...so I have started to make a easy LightSpeedHelper class. I'm also made templates that generate the skeleton for different layers for the CRUD on selected table/entities. Huge time saver... What about to make a simple LightSpeedHelper class that have the lsgen.exe logic inside, then it is easy to override it without much hazzle for the user and you guys. It is actually not much information that are needed, the operations I currently thinking about is - columns, private/public - relations, private/public - attributes for the current column/relation it is perhaps more information also, but if this available it is fairly easy to make a good codesmith (or something else) template with good override possibles. This is not very hard to make for myself but I will use some time to make make the relations/attributes things correct like lsgen.exe does since I have to analyse what lsgen.exe does on different scenarios. |
|