I created table
private static void CreateTable(SchemaBuilder builder) {
builder.CreateTable(typeof(RkeeperV7MenuRecord).Name, table => table
.Column<int>("Id", c => c.PrimaryKey().Identity())
.Column<int>("SpotId", c => c.NotNull())
.Column<DateTime>("Date", c => c.NotNull())
.Column<string>("OriginalData", c => c.NotNull().Unlimited())
);
and table in SQL Server database was created (and string has max in legth property). If i generate SQL table script from DB server it will be like this (so string is marked as unlimited)
CREATE TABLE [dbo].[Plus_Plus_SpotServerIntegration_Rkeeper_RkeeperV7MenuRecord](
[Id] [int] IDENTITY(1,1) NOT NULL,
[SpotId] [int] NOT NULL,
[Date] [datetime] NOT NULL,
[OriginalData] [nvarchar](max) NOT NULL,
PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
But... When i try to insert record in table, nhibernate throw exception "Error dehydrating property value for Plus.SpotServerIntegration.Rkeeper.Models.RkeeperV7MenuRecord.OriginalData" and inner exception is "The length of the string value exceeds the length configured in the mapping/parameter." What should i do to insert record?
PS string is about 100000 simbols (it is xml)
_rkeeperV7MenuRepositiory.Create(new RkeeperV7MenuRecord {
OriginalData = model.OriginalData,
SpotId = spot.Id,
Date = _clock.UtcNow
});
where
private readonly IRepository<RkeeperV7MenuRecord> _rkeeperV7MenuRepositiory;