开发者

How to make ObjectContext private?

I've created a BLL which queries Entity Framework context. EDML file is in the same BLL assembly. It accepts EF entities as parameters from presentation layer and returns EF entities as results. To accomplish this I kept entities public so presentation layer can create them like DLL.TablName newRecord = new DLL.TableName() et开发者_运维技巧c. The problem is with entities my objectcontext is exposed too since it's public. I can manually change it to private in designer generated code but if I make any changes to it it becomes public again. I didn't see any access modifier setting in the designer. How can I make ObjectContext private or internal?

I'm still in the layer design process so I can change my design if it can't be done.


You could probably inherit your Framework class and using the new keyword "hide" the ObjectContext like so:

public class DataContext : YourEFContext {

    private new ObjectContext ObjectContext { get; }

}

I'm pretty sure you wanted something like this...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜