实体框架 - 模型优先 - 存储/概念关联 [英] Entity Framework - Model First - Storage / Conceptual Associations

查看:85
本文介绍了实体框架 - 模型优先 - 存储/概念关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个实体框架模型,我根据需要使用它来生成SQL CE 4数据库SDF文件。

I've got a Entity Framework model, which I use to generate a SQL CE 4 database SDF file as required.

在我的EF的存储模型模式中,在定义所有实体关联(角色,参考约束等)时是否有任何要点?显然包含或不包括它们会影响输出SDF文件。

Within the Storage Model schema of my EF, is there any point in defining all the entity associations (roles, referential constraints, etc)? Obviously including or not including them affects the output SDF file.

我问,因为概念模型关联似乎单独工作,并且无论是否存在存储模型关联,功能都没有问题。数据库。

I ask because the Conceptual Model associations seem to work seperately, and function no problem with or without the Storage Model associations present in the database.

所以我想知道存储模型协会有什么好处吗?性能会是一个因素吗?还有什么?

So I wonder is there any benefit in having the Storage Model associations at all? Would performance be a factor? Anything else?

推荐答案

你好rizzlwizzl,

Hello rizzlwizzl,

 

欢迎来到MSDN论坛并感谢此处发布。

Welcome to the MSDN Forum and thank sfor posting here.

据我所知,实体框架使用概念模型提供以对象为中心的数据视图,表达作为实体类型和关联。应用程序开发人员只需考虑针对从概念模型生成的类进行编程,而不必考虑存储模式以及如何访问数据存储中的对象并将其转换为编程对象。实体框架使用概念模型,存储模型以及这些模型之间的映射
将对实体的创建,读取,更新和删除操作转换为数据源中的等效操作。

AS I know, the Entity Framework  uses a conceptual model to provide an object-centric view of data, expressed as entity types and associations. An application developer only has to think about programming against the classes that are generated from the conceptual model, rather than having to also think about the store schema and how to access objects in the data store and transform them into programming objects. The Entity Framework uses a conceptual model, storage model, and mapping between these models to transform create, read, update, and delete operations against entities into equivalent operations in the data source.

应用程序的概念模型用
表示实体和关系概念架构定义语言(CSDL),它是
实体数据模型的实现。 CSDL是一种基于XML的语言。 CSDL中定义的实体类型每个都有一个名称,一个用于唯一标识实例的键和一组属性。分配给
属性的数据类型指定为简单类型(标量属性)或复杂类型(由一个或多个标量或复杂属性组成的类型)。 XML属性还可以指定可为空性或指定默认值。关联
定义实体之间的关系。实体框架语言元素和术语在
实体框架术语中有更详细的解释。

The conceptual model for an application expresses entities and relationships in conceptual schema definition language (CSDL), which is an implementation of the Entity Data Model. CSDL is an XML-based language. Entity types defined in CSDL each have a name, a key for uniquely identifying instances, and a set of properties. The data types assigned to properties are specified as either simple types, which are scalar properties, or as complex types, which are types that consist of one or more scalar or complex properties. XML attributes may also specify nullability or assign a default value. Associations define the relationships between entities. Entity Framework language elements and terminology are explained in more detail in Entity Framework Terminology.

使用商店架构定义语言(SSDL)描述存储模型。在SSDL中声明的属性的数据类型是存储模型的数据类型。

The storage model is described with store schema definition language (SSDL). The data types of properties declared in SSDL are those of the storage model.

映射规范使用映射规范语言(MSL)将概念模型映射到存储模型。

A mapping specification uses mapping specification language (MSL) to map the conceptual model to the storage model.

更多信息,请看:

http://msdn.microsoft.com/en-us/library/bb399232.aspx

我希望这可以帮到你。

 

祝你有愉快的一天,


这篇关于实体框架 - 模型优先 - 存储/概念关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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