simple entity framework sample RRS feed

  • Question

  • Hi all

    I am new with entity framework ...

    I have a data model implemented in SQL Server (tables and relationships).
    From that I have build an edmx file.

    Now, at runtime, I like to connect to a SQL Server and query some data.
    I have tried to following, but I cannot get this to work. Metadata ??

    Thanks for some samples.

    Frank Uray

                // create native SQL connection
       _clsSQLServer = new"Some SQL Server""Some SQL Server Instance");             _clsSQLServer.ConnectionCreate();             System.Data.EntityClient.EntityConnectionStringBuilder _EntityConnectionStringBuilder = new System.Data.EntityClient.EntityConnectionStringBuilder();             _EntityConnectionStringBuilder.Provider = "System.Data.SqlClient";             _EntityConnectionStringBuilder.ProviderConnectionString = _clsSQLServer.return_SqlConnection.ConnectionString;             _EntityConnectionStringBuilder.Metadata = "??";    _userEntities = new System.Data.EntityClient.EntityConnection(_EntityConnectionStringBuilder.ToString()));             foreach (var _User in _userEntities.Users)             {                 System.Windows.Forms.MessageBox.Show(_User.User);             }
    • Moved by Alexander Sun Thursday, June 7, 2012 6:36 AM Move to more appropriate forum (From:Visual C# General)
    Wednesday, June 6, 2012 10:19 AM


  • Hi frank.uray,

    Welcome to MSDN Forum.

    Metadata is a pipe-separated path of folders and individual files where the model and mapping files are stored. So the value is deciding upon where's your edmx file stores.

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, June 7, 2012 7:49 AM

All replies