November 27, 2007
Been using NHibernate on my most recent project and the team and I have spent a bit of time trying to figure out how to get around the fact that NHibernate generates all strings as nvarchar(255) by default. We’re also using Attributes for our NHibernate mappings (NHibernate.Mapping.Attributes). The solutions is actually quite simple.
private string _myString;
[Property(length = 4001)]
public string MyString
{
get { return _myString; }
set { _myString = value; }
}
Setting the length to anything over 4000 forces NHibernate to generate the DB schema with a DB type of nvarchar(MAX).
I’ve only tested this with the SQL 2005 dialect (Dialect.MsSql2005Dialect)
4 Comments |
DAL, NHibernate, asp.net, coding |
Permalink
Posted by Dan Silivestru
September 21, 2007
Came across this today: Subsonic It’ll build your entire DAL (Data Access Layer). So you end up with a typed object representation of your database. Really cool and could save lots of time. It also has Ruby on Rails like scaffolding built right in. I’m about to start using it and will post once I’ve had a chance to put it through its paces. In the mean time, my praises go out to the Subsonic team for putting together what I think has been a long needed addition to .net.
If anyone has used this already, please let me know what your experience with it has been like.
Leave a Comment » |
DAL, Technology, asp.net, coding, work |
Permalink
Posted by Dan Silivestru