I can look into it some more, how about setting a field length higher then 4000 from the Fluent NHibernate code when either Clob or Blob is assigned (in the background, so not by the user itself)? This is a dirty trick, but at least you won't have users wondering what is going on. Depending on what NHibernate does with the actual value you have to set it really high or just at 4001?
-Mark On Dec 11, 6:42 am, "Paul Batum" <[email protected]> wrote: > Hi there Mark, > > As Alec mentioned he is also struggling with this problem. You should > probably read this > post:http://groups.google.com/group/fluent-nhibernate/browse_thread/thread... > > If you can find out how to set up the xml so that a ntext column is created, > we can help you figure out how to get the necessary xml generated with > fluent nhibernate. > > Paul Batum > > On Thu, Dec 11, 2008 at 1:06 PM, Alec Whittington < > > [email protected]> wrote: > > Mark, I can confirm this behavior. You will probably note that if you > > do not add the length, it puts a default length of 100. If you do an > > AddAlteration to remove the length, it will generate as a NVARCHAR(255) in > > the SQL schema for the table. > > > I brought up something similar in another email. > > > Alec Whittington > > > On Wed, Dec 10, 2008 at 5:40 AM, <[email protected]> wrote: > > >> Hi, > > >> I say possible because it can be just as well be me :) > > >> I have the following code: > > >> var config = new Configuration(); > > >> var msSqlConfiguration = > >> MsSqlConfiguration > >> .MsSql2000 > >> .UseOuterJoin() > >> .DoNot.ShowSql() > >> .ConnectionString > >> .Database(databaseName) > >> .Server(databaseServer) > >> .TrustedConnection > >> .Create > >> .ConfigureProperties(config); > > >> var model = AutoPersistenceModel > >> .MapEntitiesFromAssemblyOf<IRepositoryItem>() > >> .WithConvention( > >> convention => > >> { > >> convention.DefaultStringLength = 255; > >> //convention.OneToManyConvention = p => p.LazyLoad(); > >> //convention.OneToManyConvention = p => p.IsInverse(); > >> convention.FindIdentity = p => p.Name == "Id"; > >> convention.GetForeignKeyName = p => p.Name + "_Id"; > >> convention.GetForeignKeyNameOfParent = p => p.Name + > >> "_Id"; > >> convention.AddTypeConvention(new EnumerationTypeConvention > >> ()); > >> }); > > >> AddMappingsForMerchandise(model); > > >> private static void AddMappingsForMedicamentPackage > >> (AutoPersistenceModel model) > >> { > >> model.ForTypesThatDeriveFrom<MedicamentPackage>(map => > >> map.Map(p => p.PreparationDescription) > >> .CustomSqlTypeIs("NTEXT") > >> .CustomTypeIs("StringClob"); > >> } > > >> Now the specific problem is in the last method where I want to map the > >> property to a ntext column in the database (we generate the DB from > >> the mappings) In this case a column of type nvarchar(255) will be > >> generated the only way I could get this to be a ntext column is by > >> specifying a length bigger then 4000 (so 4001 becomes ntext). > > >> private static void AddMappingsForMedicamentPackage > >> (AutoPersistenceModel model) > >> { > >> model.ForTypesThatDeriveFrom<MedicamentPackage>(map => > >> map.Map(p => p.PreparationDescription) > >> .CustomSqlTypeIs("NTEXT") > >> .CustomTypeIs("StringClob") > >> .WithLengthOf(1000000)); > >> } > > >> It looks like with respect to SQlType ntext it is ignored unless I > >> specific manually that it will be bigger then the SQL Server 2000 > >> nvarchar can handle. > > >> -Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" 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/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
