.net EF代码第一个现有SQL Azure数据库

.net EF代码第一个现有SQL Azure数据库,.net,sql,entity-framework,azure,ef-code-first,.net,Sql,Entity Framework,Azure,Ef Code First,我首先使用代码在本地服务器上成功创建了数据库,并将其迁移到 Azure,现在我想使用Azure连接字符串和我现有的POCO类别连接到该数据库 我的连接字符串: <add name="CijenolomciContext" connectionString="Data Source=*.database.windows.net;Initial Catalog=NewCijenolomci;Persist Security Info=True;User ID=Bip*;Password=**;

我首先使用代码在本地服务器上成功创建了数据库,并将其迁移到 Azure,现在我想使用Azure连接字符串和我现有的POCO类别连接到该数据库

我的连接字符串:

<add name="CijenolomciContext" connectionString="Data Source=*.database.windows.net;Initial Catalog=NewCijenolomci;Persist Security Info=True;User ID=Bip*;Password=**;MultipleActiveResultSets=False&quot;" providerName="System.Data.EntityClient" />
如何成功添加它

编辑:
这种方法碰巧修改了我的本地数据库,而不是服务器数据库。

对我来说,你似乎没有连接到Azure数据库。我希望连接字符串更像这样

Server=tcp:[serverName].database.windows.net;Database=myDataBase;User ID=[LoginForDb]@[serverName];Password=myPassword;Trusted_Connection=False;Encrypt=True;

Use 'username@servername' for the User ID parameter.

请参阅。

在我看来,您并没有连接到Azure数据库。我希望连接字符串更像这样

Server=tcp:[serverName].database.windows.net;Database=myDataBase;User ID=[LoginForDb]@[serverName];Password=myPassword;Trusted_Connection=False;Encrypt=True;

Use 'username@servername' for the User ID parameter.

请参阅。

确定。给你。在DbContext中,我继承基本构造函数:

 public CijenolomciContext()
        : base(*database name*)
    {
        //additional logic
    }
尽管我在
App.config
中添加了我的连接字符串,但他总是连接到本地服务器


我硬编码了连接字符串,并将其添加到构造函数中。现在它工作了!:)

好的。给你。在DbContext中,我继承基本构造函数:

 public CijenolomciContext()
        : base(*database name*)
    {
        //additional logic
    }
尽管我在
App.config
中添加了我的连接字符串,但他总是连接到本地服务器


我硬编码了连接字符串,并将其添加到构造函数中。现在它工作了!:)

当我使用这种连接字符串并将其不断添加到本地数据库时:/n可能是因为我继承了DbContext中的基本构造函数,但是现在当我更改它时,我得到了
System.ArgumentException:关键字不受支持:“服务器”。
当我使用这种连接字符串并将其不断添加到本地数据库时:/这可能是因为我在DbContext中继承了基构造函数,但现在当我更改它时,我得到了
System.ArgumentException:关键字不受支持:“服务器”。