Dodaję do projektu New Item -> ADO.NET Entity Data Model na podstawie pustego modelu.
Powstaje Model1.edmx i automatcznie zostaje wygenerowana klasa ModelContainer dziedzicząca po ObjectContext.
Ma trzy konstruktory:


        /// <summary>
        /// Initializes a new Model1Container object using the connection string found 
        /// in the 'Model1Container' section of the application configuration file.
        /// </summary>
        public Model1Container() : base("name=Model1Container", "Model1Container")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new Model1Container object.
        /// </summary>
        public Model1Container(string connectionString) : base(connectionString, "Model1Container")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new Model1Container object.
        /// </summary>
        public Model1Container(EntityConnection connection) : base(connection, "Model1Container")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }

Próbuję utworzyć obiekt:

 
           EntityConnectionStringBuilder ecsb = new EntityConnectionStringBuilder();

           ecsb.Provider = "System.Data.SqlServerCe.3.5";
           ecsb.ProviderConnectionString = "c:\\1.sdf";
           ecsb.Metadata = "metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl";

           Model1Container  c = new Model1Container (ecsb.ConnectionString);

i dostaję taki komunikat: The underlying provider failed on ConnectionString.

Jak poprawnie utworzyć obiekt z klasy ModelContainer ?