2011-07-28 37 views
1

希望有人对我的linq-to-sql datacontext中的类型使用我的web.config提供程序属性中的type属性有一个想法。在Web.Config配置文件属性中使用DataContext类型

<profile enabled="true"> 
     <properties> 
      <add name="UserSetting" allowAnonymous="true" type="MyApp.DataAccess.UserSetting" /> 
     </properties> 
    </profile> 

因此,在这种情况下,UserSetting是我数据库中的一个表格,我使用Linq将其映射到Sql。或者,在过去,我已经指定了一个我在应用程序中明确写入的类,它工作正常。我宁愿让它动态链接。

希望这是有道理的 - 谢谢!

+0

我认为主要问题是我没有把这称为正确的事情 - 任何人有想法? – localman

+0

实体类是他们被称为的东西。 – localman

回答

1

我得到它的工作。

我需要将system.data.linq程序集添加到web.cofig。

<compilation debug="true" targetFramework="4.0"> 
     <assemblies> 
     <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
     </assemblies> 
    </compilation> 

哦 - 并且不要忘记配置文件提供程序。

相关问题