我们在ASP.NET应用程序中使用ADO.NET Entity.
我已经读过预先生成的视图可以提高性能.提到博文,
http://blogs.msdn.com/adonet/archive/2008/06/20/how-to-use-a-t4-template-for-view-generation.aspx,我生成了视图.命名空间和类生成为
namespace Edm_EntityMappingGeneratedViews
{
/// <Summary>
/// The type contains views for EntitySets and AssociationSets that were generated at design time.
/// </Summary>
public sealed class ViewsForBaseEntitySets4D4A6E0AA7AF6B2298FABB4F22235831 : System.Data.Mapping.EntityViewContainer
{
/// <Summary>
/// The constructor stores the views for the extents and also the hash values generated based on the metadata and mapping closure and views
/// </Summary>
public ViewsForBaseEntitySets4D4A6E0AA7AF6B2298FABB4F22235831()
{
this.EdmEntityContainerName = "JSEntities";
Run Code Online (Sandbox Code Playgroud)
我将其添加到我的数据层并测试性能.无法看到太多改善.CPU使用率总是达到20-30%利用率(响应时间良好)并在500毫秒内减少回0% - 1秒.我认为由于每次生成视图,CPU利用率很高.
我无法理解实体框架如何知道这是我的模型事件的预生成视图类,而MyModel.edmx和MyModel.Views.cs与文件名匹配.
我是否应该更新Web.Config或App.Config以将View类映射到某个地方的模型?
请澄清.