c# - Convert (System.Data.SqlClient) to Entity -


i want run multi select 1 trying ,

i find 1 way sqlcommand , works, looking way entity , please me finding way entity or convert code want .

string commandtext = @"select id, contactid dbo.subscriptions;  select id, [name] dbo.contacts;";   list<subscription> subscriptions = new list<subscription>(); list<contact> contacts = new list<contact>();  using (sqlconnection dbconnection = new sqlconnection(@"data source=server;database=database;integrated security=true;")) using (sqlcommand dbcommand = new sqlcommand(commandtext, dbconnection)) {     dbcommand.commandtype = commandtype.text;     dbconnection.open();      sqldatareader reader = dbcommand.executereader();      while (reader.read())     {         subscriptions.add(             new subscription()             {                 id = (int)reader["id"],                 contactid = (int)reader["contactid"]             });     }      reader.nextresult();      while (reader.read())     {         contacts.add(             new contact()             {                 id = (int)reader["id"],                 name = (string)reader["name"]             });     }      dbconnection.close(); } 


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -