c# - Migrations.cs is not created successfully -
i creating new module called "sms" in orchard cms using webmatrix. create when generate "migrateions.cs", doesn't generated successfully.
my sms.cs
class in model given below
using system.collections.generic; using system.web; using system.componentmodel.dataannotations; using system.componentmodel; using orchard.contentmanagement; using orchard.contentmanagement.records; namespace smss.model{ public class smsrecord:contentpartrecord { public virtual int id{get;set;} public virtual string name{get;set;} public virtual char is_deleted{get;set;} } public class smspart:contentpart<smsrecord> { [required] public int id { get{return id=record.id;} set{record.id=value;} } public string name { get{return name=record.name;} set{record.name=value;} } public char is_deleted { get{return is_deleted=record.is_deleted;} set{record.is_deleted=value;} } }
and generated migrations.cs
class follow
using system; using system.collections.generic; using system.data; using orchard.contentmanagement.drivers; using orchard.contentmanagement.metadata; using orchard.contentmanagement.metadata.builders; using orchard.core.contents.extensions; using orchard.data.migration; namespace sms { public class migrations : datamigrationimpl { public int create() { return 1; } } }
the "migrations.cs" not generated why?? please help
class generated properly, although lacks code creating appropriate tables because didn't adhere naming conventions record class.
data migration code generation requires follow several conventions in order work properly. i.e.:
- namespace of record must end
.models
or.records
- there has exist public property named
id
- all properties have virtual (required nhibernate anyway)
- class cannot sealed
- class cannot abstract
- class has implement
icontent
or subclass ofcontentpartrecord
in case, namespace (should end .models
) , incorrect casing of id
(should id
) culprits.
Comments
Post a Comment