C# 我可以将元数据类类型对象强制转换为部分类类型对象吗?
我有类似的东西C# 我可以将元数据类类型对象强制转换为部分类类型对象吗?,c#,asp.net-mvc-4,downcast,C#,Asp.net Mvc 4,Downcast,我有类似的东西 [MetadataType(typeof(MetaData_Course_application))] partial class COURSE_APPLICATION { } public class MetaData_Course_application { [Required] [StringLength(15, MinimumLength = 2)] public string ENTRANCE_ROLL_NO { get; set; }
[MetadataType(typeof(MetaData_Course_application))]
partial class COURSE_APPLICATION
{
}
public class MetaData_Course_application
{
[Required]
[StringLength(15, MinimumLength = 2)]
public string ENTRANCE_ROLL_NO { get; set; }
public int SESSION_ID { get; set; }
public int ENTRANCE_ID { get; set; }
public Int64 COURSE_ID { get; set; }
public DateTime DATE_OF_APPLICATION { get; set; }
public Int64 RANK { get; set; }
public Int64 STUDENT_ID { get; set; }
public bool FEE_PAID { get; set; }
public bool IS_CANCLED_BY_STUDENT { get; set; }
}
and now i want
public void ApplyForCourse(ERP.MetaData_Course_application Coll)
{
COURSE_APPLICATION Collection=(COURSE_APPLICATION)coll;
context = new ERPDataContext();
context.COURSE_APPLICATIONs.InsertOnSubmit(Collection);
context.SubmitChanges();
}
像这样的事情有可能吗?如果不是,最好的解决方案是什么?请提前感谢什么是“收集”?当然对象\u应用程序类(表)什么不起作用?真正的问题是什么?课程应用程序集合=(课程应用程序)coll;