c# - 无法理解此 MySQL 连接字符串

标签 c# mysql wpf entity-framework-6

我正在为我们的一位客户排除 WPF C# 应用程序的故障。

该应用程序连接到 MySQL 数据库。但是,连接字符串采用“元数据”形式,带有 .ssdl 和 .msl 文件

这个元数据是什么,ssdl 和 msl 文件?

<add name="NFMEntity" connectionString="metadata=res://*/TrendData.csdl|res://*/TrendData.ssdl|res://*/TrendData.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;server=127.0.0.1;user id=mmm;password=mmmmmm;persistsecurityinfo=True;database=nfm&quot;" providerName="System.Data.EntityClient" />

最佳答案

EF 使用包含 .csdl、.ssdl 和 .msl 的元数据部分,它们包含您通过 EF 描述的模型的不同层。此部分不是数据库连接字符串的一部分。

Exploring how the Entity Data Model (EDM) Generates Code and Executes Queries – Entity Framework 4.0博客文章提供了这些层的高级描述:

We know that Entity Framework maps database tables to objects. This is done in 3 different layers:

Logical Layer: The Logical Layer also called Storage Layer is defined by the Store Schema Definition Language (SSDL) and defines the structure of the tables and relations between them.

Conceptual Layer: The Conceptual Layer is defined by the Conceptual Schema Definition Language (CSDL) and defined .NET classes.

Mapping Layer: The Mapping Layer is defined by Mapping Specification Language (MSL) and connects the entity type definition from the CSDL to the metadata defined in the SSDL, hence the name C-S mapping. So the mapping is essentially from .NET classes to the table structure and its relations.

At runtime, this .edmx is split into these three different files (.ssdl, .csdl and .msl).

关于c# - 无法理解此 MySQL 连接字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39029818/

相关文章:

php - 将 php 脚本更改为 PDO 导致 MySQL 更新查询期间出现语法错误

mysql - 删除所有未更改的条目(sql)

wpf - 如何使用 Trigger 检查 DataGridColumnHeader 的 ColumnIndex 是否是最后一个?

c# - 如何从 MenuItem 完全自定义弹出窗口?

c# - 为什么我必须在不需要时使用关键字 static?

c# - 如何在具有多个相同控件的窗体上实现接口(interface)?

c# - 将 jpeg 图像转换为十六进制格式

mysql - 无法在 my.cnf 中设置 sql_mode

.net - 如何将样式应用于类及其后代?

c# - 聚合异常不包含所有任务异常?