LinqToSql and abstract base classes

前端 未结 4 480
[愿得一人]
[愿得一人] 2021-01-18 11:59

I have some linq entities that inherit something like this:

public abstract class EntityBase { public int Identifier { get; } }

public interface IDeviceEnti         


        
4条回答
  •  旧时难觅i
    2021-01-18 12:34

    This kind of heirarchial mapping isnot possible with LinqToSql. The the mapping is setup it cannot map to properties in base classes. I went around on this for a couple of months when it first came out. The best solution is to use the entity framework. It gives you much more flexibility with creating your object model. It will allow you to do exactly what your trying to do here.

    Here is some information on the entity framework: MSDN Article

提交回复
热议问题