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/a5494a33640da2d5?hl=en
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
-~----------~----~----~----~------~----~------~--~---