为了避免使用Table Per Hierarchy(TPH),我一直在研究如何在我的数据库模型中最好地实现Table-Per-Concrete Class(TPC)继承.我遇到了官方文档和本文.
下面是一些带有一些简单继承的模型类.
public class BaseEntity
{
public BaseEntity()
{
ModifiedDateTime = DateTime.Now;
}
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public DateTime ModifiedDateTime { get; set; }
}
public class Person : BaseEntity
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class Business : BaseEntity
{
public string Name { get; set; }
public string Location { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
根据两篇文章中的示例使用的DbModelBuilder配置. …
我正在使用Visual Studio 2010并安装了"Microsoft Report Viewer 2012 Runtime",希望在SQL 2012中测试新的报告系统.之后我从Web.config中删除了对"Microsoft.ReportViewer.WebForms"的引用,并删除了ReportViewer从我的工具箱控制并添加新版本11 ReportViewer.
我将新控件添加到测试页面,并将其添加到测试页面:
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
Run Code Online (Sandbox Code Playgroud)
并将这些条目添加到Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
Run Code Online (Sandbox Code Playgroud)
工具箱中的控件是版本11添加,但系统不断尝试参考版本10版本.此外,当我尝试编译它时,我收到错误:
The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'
Run Code Online (Sandbox Code Playgroud)