Modify SSDL runtime for ADO.NET and Entity Framework

大憨熊 提交于 2019-12-13 00:13:32

问题


I would like to undertand how to modify on fly the SSDL in a connection string.

I have followed the tutorial here: http://www.codeproject.com/Articles/82017/Preparing-an-Entity-Framework-model-for-multi-prov , but I am still not able to understand how to configure the "res://" line and where to put the .ssdl file.

I have a complex hierarchical structure to be compiance to an adapter structure:

<project root> 
    / Toolkit 
        / Database 
            / External 
                / Adapter 
                    / Abstract.cs
                    / File
                        / File.ssdl
                        / Adapter_File.cs
                    / MySql
                        / MySql.ssdl
                        / Adapter_MySql.cs
    [... and so on]

Into my Adapter_(database_type).cs I have the following code (this is for MySql:

    string conn =
              @"metadata=res://*/Toolkit.Database.External.ADO.ADODatabase.csdl" +
              @"|res://*/Toolkit.Database.External.Adapter.MySql.MySql.ssdl" +
              @"|res://*/Toolkit.Database.External.ADO.ADODatabase.msl;" +
              @"provider=MySql.Data.MySqlClient;" +
              "provider connection string=\"server=" + dbBean.Server + ";" +
              "Port=" + dbBean.Port + ";" +
              "User Id=" + dbBean.Username + ";"+
              "Password=" + dbBean.Password + ";" +
              "database=" + dbBean.Schema + "\"";

Everything seems to work fine, but runtime my application returns an error trying to connect to each database, it seems to not to reach the .ssdl file...

Any ideas? Thank you!

来源:https://stackoverflow.com/questions/9903988/modify-ssdl-runtime-for-ado-net-and-entity-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!