locked
System.Data.EntityClient not recognized, by code.but recognized by web.config RRS feed

  • Question

  • Hello users,

    when i simply run the project, data is get from server no problems

    but

    theres a requirement of connection string to be in code.
    --

    according to material on net i did the following, but just cannot solver the error.

    stuck here for about a few days.

    error
    ---
    The specified store provider cannot be found in the configuration, or is not valid.


    domainservice
    ---

       

    public class DomainService1 : LinqToEntitiesDomainService<EMPLOYEEEntities>
            {
        
                public override void Initialize(DomainServiceContext context)
                {
        
                    EntityConnectionStringBuilder builder = new EntityConnectionStringBuilder();
                    builder.Provider = "System.Data.EntityClient";
                    builder.ProviderConnectionString = @"Data Source=A-63A9D4D7E7834\THIRD;Initial Catalog=EMPLOYEE;Integrated Security=True;";
                    builder.Metadata = string.Format(@"res://*/{0}.csdl|
                            res://*/{0}.ssdl|
                            res://*/{0}.msl", "Model1");
                    
                    this.ObjectContext.Connection.ConnectionString = builder.ConnectionString;
                    base.Initialize(context);
        
                }
    




    web.config
    ---

        <connectionStrings>
            <add name="EMPLOYEEEntities"
                 connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=A-63A9D4D7E7834\THIRD;Initial Catalog=EMPLOYEE;Integrated Security=True;MultipleActiveResultSets=True&quot;"
                 providerName="System.Data.EntityClient" />
          </connectionStrings>
        

    Friday, March 4, 2011 7:40 AM

Answers