Unable to use Orchard ContentPart with ntext column

Course Queries Syllabus Queries 3 years ago

8.27K 2 0 0 0

User submissions are the sole responsibility of contributors, with TuteeHUB disclaiming liability for accuracy, copyrights, or consequences of use; content is for informational purposes only and not professional advice.

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 3 years ago

 

I have a table created in the sql ce database for my content part "CourseDescription". The "Syllabus" column uses ntext as it's type. However, when I try to create a CourseDescription I get the following exception:

[InvalidOperationException: @p1 : String truncation: max=4000, len=11501, value='<p>
<strong>About this Coursestrong><br /> ...


  System.Data.SqlServerCe.SqlCeCommand.FillParameterDataBindings(Boolean verifyValue) +914
   System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options) +614
   System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() +21
   NHibernate.AdoNet.AbstractBatcher.ExecuteNonQuery(IDbCommand cmd) +297
   NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation) +16
   NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +968
   NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session) +195
   NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session) +354
   NHibernate.Action.EntityUpdateAction.Execute() +399
   NHibernate.Engine.ActionQueue.Execute(IExecutable executable) +117
   NHibernate.Engine.ActionQueue.ExecuteActions(
                                                
0 views
0 shares

profilepic.png
manpreet 3 years ago

Try to use the StringLengthMax attribute on your Syllabus property inside record class, like:

[StringLengthMax]
public virtual string Syllabus { get; set; }

This will make NHibernate aware of the unlimited length.

HTH


0 views   0 shares

No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

Similar Forum