Well, I am back with a same problem and here is a stack trace
InnerException: The field 'RecordId' is read-only and can't be changed.
Message: DotNetNuke.Services.Exceptions.ModuleLoadException: The field 'RecordId' is read-only and can't be changed. ---> SD.LLBLGen.Pro.ORMSupportClasses.ORMFieldIsReadonlyException: The field 'RecordId' is read-only and can't be changed. at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ValidateValue(IEntityField2 fieldToValidate, Object value, Int32 fieldIndex) at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.SetNewFieldValue(Int32 fieldIndex, Object value, Boolean fireChangeEvent) at MindSphere.IC.Queries.EntityClasses.UserQueryEntity.SetNewFieldValue(Int32 fieldIndex, Object value) in C:\MindSphere\INTERNAL\IC.BLL\MindSphere.IC.Queries2\Entities\EntityClasses\UserQueryEntity.vb:line 151 at MindSphere.IC.Queries.EntityClasses.UserQueryEntity.set_RecordId(Int32 Value) in C:\MindSphere\INTERNAL\IC.BLL\MindSphere.IC.Queries2\Entities\EntityClasses\UserQueryEntity.vb:line 807 at MindSphere.IC.Queries.Core.Managers.UserQueryManagerBase.FetchUsingUniqueConstraintRecordId(Int32 recordId, IDataAccessAdapter adapter) in C:\MindSphere\INTERNAL\IC.BLL\MindSphere.IC.Queries2\Core\Managers\Base\UserQueryManagerBase.vb:line 208 at MindSphere.IC.Queries.Core.Managers.UserQueryManagerBase.FetchUsingUniqueConstraintRecordId(Int32 recordId) in C:\MindSphere\INTERNAL\IC.BLL\MindSphere.IC.Queries2\Core\Managers\Base\UserQueryManagerBase.vb:line 193 at MindSphere.DNN.Modules.DataAnalyzer.QueryEdit.Page_Load(Object sender, EventArgs e) in C:\MindSphere\INTERNAL\IC_DEV\Information Center Branches\Modules\MindSphere.DataAnalyzer (shared queries)\Pages\QueryEdit.ascx.vb:line 86 --- End of inner exception stack trace ---
Problem is acutally in Manager template. Method created looks like this. RecordId is read only as it is identity column. So the question is more on manager templates. If I don't create unique constraint on this field, then templates do not generate a method, so I have to do it manually. But if I do then I have problem above. Has anybody run into this with templates?
Public Overloads Shared Function FetchUsingUniqueConstraintRecordId( ByVal recordId As Int32, ByVal adapter As IDataAccessAdapter ) As UserQueryEntity
Dim entity As New UserQueryEntity()
entity.RecordId = recordId
If (adapter.FetchEntityUsingUniqueConstraint(entity, entity.ConstructFilterForUCRecordId()))
Return entity
Else
Return Nothing
End If
End Function