Note that there are some explanatory texts on larger screens.

plurals
  1. POConnection Strings for Entity Framework
    primarykey
    data
    text
    <p>I want to share same Database information across multiple entities in Silverlight.. but I want the connection string to be named xyz and have everyone access that connection string from machine.config... </p> <p>The meta data part of the entities will be different since I didn't name the entities the same..</p> <p>Can I put multiple entities in that metadata section?</p> <p>Here is an example.. I want to use this connection string but note that i put multiple entities in the metadata section..</p> <p>Basically I want to take this Connection String</p> <pre><code>&lt;add name="XYZ" connectionString="metadata=res://*/ModEntity.csdl|res://*/ModEntity.ssdl|res://*/ModEntity.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=SomeServer;Initial Catalog=SomeCatalog;Persist Security Info=True;User ID=Entity;Password=SomePassword;MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient" /&gt; </code></pre> <p>And this Connection String</p> <pre><code> &lt;add name="XYZ" connectionString="metadata=res://*/Entity.csdl|res://*/Entity.ssdl|res://*/Entity.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=SOMESERVER;Initial Catalog=SOMECATALOG;Persist Security Info=True;User ID=Entity;Password=Entity;MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient" /&gt; </code></pre> <p>To make this Connection String</p> <pre><code>&lt;add name="XYZ" connectionString="metadata=res://*/Entity.csdl|res://*/Entity.ssdl|res://*/Entity.msl|res://*/ModEntity.csdl|res://*/ModEntity.ssdl|res://*/ModEntity.msl;provider=System.Data.SqlClient;provider connection string=&amp;quot;Data Source=SOMESERVER;Initial Catalog=SOMECATALOG;Persist Security Info=True;User ID=Entity;Password=SOMEPASSWORD;MultipleActiveResultSets=True&amp;quot;" providerName="System.Data.EntityClient" /&gt; </code></pre> <p>But it simply doesn't work. Neither project can connect to it.</p> <pre><code>string encConnection = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString; Type contextType = typeof(test_Entities); object objContext = Activator.CreateInstance(contextType, encConnection); return objContext as test_Entities; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload