The length of a filed should be set in the mapping (directly or using some mapping-source) and should be checked in the front-end where available and should be checked in BusinessLayer (perhaps using frameworks as NHV).
2009/7/14 Gustavo Ringel <[email protected]> > i just said i personally didn't like the idea, like in i'm expressing my > opinion only :). The place for suggesting features is the JIRA where the > NH developers can give you their vision if they do not agree. > > Gustavo. > > > On Wed, Jul 15, 2009 at 12:08 AM, Josh Rogers <[email protected]>wrote: > >> >> Gustavo, >> >> I agree that it is a good thing that you don't do this automatically. >> I had just assumed it since that is what the DB's I've dealt with in >> the past have done, that is why I clarified. I would like the feature >> I mentioned, but I am intimate enough with my DB that I will always be >> aware of the column size, some developers may not. I wasn't saying or >> trying to imply that you or any of the developers did anything wrong >> or that the design was bad. >> >> Sorry if it was taken that way. >> >> Josh >> >> On Tue, Jul 14, 2009 at 4:02 PM, Gustavo Ringel<[email protected]> >> wrote: >> > in this case the good developers lived you automagically ignoring that >> there >> > is a big problem...IMHO. >> > it's like the glorious try { } catch { // do nothing } >> > Your code does not break, but...wait you really did want that? >> > Gustavo. >> > >> > On Tue, Jul 14, 2009 at 10:19 PM, Josh Rogers <[email protected]> >> wrote: >> >> >> >> Thank you. Yeah, after I posted the question I figured that would >> >> probably be the response that I would receive. Essentially, which is >> >> a good thing I guess, the developers do not want to do anything to the >> >> data without your explicit direction on what to do. That makes sense, >> >> but it would be nice to be able to have a property like >> >> TruncateStringsToLength that you could set to true to have NHibernate >> >> do this for you so you do not have to worry about the size of the >> >> field. SQL Server automagically truncates the string for you I would >> >> think it would be acceptable to replicate that behavior since that is >> >> what the DB would do anyways. I know that all DB's might not do that >> >> hence the need for the property. >> >> >> >> Thanks for your response! >> >> Josh >> >> >> >> On Tue, Jul 14, 2009 at 2:10 PM, Roger Kratz<[email protected]> >> >> wrote: >> >> > >> >> > It's used by SchemaExport. It may also be used by you (or other fw) >> if >> >> > you need this info for your own purposes. >> >> > >> >> > AFAIK, nh does not use this info for any validation/truncation at >> all. >> >> > How should this be done in some general way? Truncated? Throw ex? >> Trim the >> >> > string? etc etc >> >> > >> >> > /Roger >> >> > >> >> > ________________________________________ >> >> > Från: [email protected] [[email protected]] för >> Josh >> >> > Rogers [[email protected]] >> >> > Skickat: den 14 juli 2009 20:11 >> >> > Till: [email protected] >> >> > Ämne: [nhusers] Length attribute in property element >> >> > >> >> > I am curious as to whether this serves any purpose? I just recently >> >> > had an issue where I was trying to push a string that was too long >> >> > into a column. I knew it was too long but I made sure the Length >> >> > attribute was set to the desired length assuming (which I should not >> >> > have done) that NHibernate would take care of the truncation of the >> >> > string. I assumed that this was the purpose of the length attribute >> >> > in the mapping file, obviously this is not the case so could someone >> >> > explain the purpose? >> >> > >> >> > Thanks! >> >> > Josh >> >> > >> >> > >> >> > > >> >> > >> >> >> >> >> > >> > >> > > >> > >> >> >> > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
