如何生成私有LINQ to SQL类? [英] How to generate private LINQ to SQL classes?

查看:59
本文介绍了如何生成私有LINQ to SQL类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图弄清楚如何使生成的 LINQ to SQL 类被标记为私有而不是公共,因此在程序集外部不可见.在Visual Studio O/R设计器或

I'm trying to figure out how to make the generated LINQ to SQL classes be marked private instead of public, so that it is not visible outside the assembly. There doesn't seem to be a way to do this in the Visual Studio O/R designer or the SqlMetal tool, unless I'm missing something. Is there a way to do this?

我之所以问是因为我在内部使用LINQ to SQL作为业务逻辑程序集中的数据访问层.我向客户展示了一组单独的自定义实体类,并且我根本不希望公开LINQ to SQL类.

I'm asking because I'm using LINQ to SQL internally as a data access layer in a business logic assembly. I am exposing to clients a separate set of custom entity classes, and I don't want the LINQ to SQL classes to be exposed at all.

推荐答案

有可能在Visual Studio Designer中选择类,然后在属性中将 Access 更改为 Internal .

It is possible, in the Visual Studio Designer select the class and in properties you can change Access to Internal.

替代文本http://img410.imageshack.us/img410/970/l2svs2008access .png

相同的原则适用于 DataContext 本身(只需单击设计器的空白区域"),然后在属性下进行更改.

The same principles apply for the DataContext itself (just click in the "white area" of the designer) and change under Properties.

这篇关于如何生成私有LINQ to SQL类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆