none
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.

    Regards
    Frank Uray

                // create native SQL connection
                symmetric.data._sqlserver.clsSQLServer _clsSQLServer = new symmetric.data._sqlserver.clsSQLServer("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 = "??";             symmetric.users.data.userEntities _userEntities = new symmetric.users.data.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

Answers

  • 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
    Moderator

All replies