Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

ASP.Net Get Datasource name only from entity connection string?

Hello all,

I have the following as an example:

<add name="CustomerEntities" connectionString="metadata=res://*/Customer.csdl|res://*/Customer.ssdl|res://*/Customer.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=DB111-SERVER;initial catalog=Customer;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />

I need to get the server name only into a string variable so "DB111-SERVER".   I tried using the SQL SqlConnectionStringBuilder but it throws an error on metadata doesn't understand it.
ASKER CERTIFIED SOLUTION
Avatar of sudheeshthegreat
sudheeshthegreat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbornstein2
sbornstein2

ASKER

Entity Framework needs the metadata to build your entity mappings.
tx