反映派生类有条件

时间:2012-03-08 14:19:33

标签: c# .net linq entity-framework reflection

我有一个从IComplexAuditableEntity继承的对象实例,我需要派生继承ILogabbleEntity的类,

我想象下面的代码,但是icant就是这样做的。

if (dbObjectEntry is IComplexAuditableEntity)
{
    dbObjectEntry.GetType()...().where(basetype == ILogabbleEntity)
}

public partial class User : IComplexAuditableEntity
{     
    public int Id { get; set; }
    public string Email { get; set; }
    public string UserPassword { get; set; }
    public string UserName { get; set; }
    public string LastName { get; set; }
    public string FirstName { get; set; }
}

public class UserLog:User,ILogabbleEntity
{
    public int ModifiedBy { get; set; }
    public DateTime Modified { get; set; }
}

public interface IComplexAuditableEntity
{
}

public interface ILogabbleEntity
{
    int ModifiedBy { get; set; }
    DateTime Modified { get; set; }
}

0 个答案:

没有答案