none
How can i change my System.Data.Objects.ObjectSet<StoreTEST> to point to System.Data.Objects.ObjectSet<Store> in PROD RRS feed

  • Question

  • I have an entity in DEV environment called StoreTEST which is uses StoreTEST table in dev;

    now this StoreTEST  table becomes Store table (without TEST at the end) in PROD environment with identical schema (PK and FK same etc);

    How can i change my System.Data.Objects.ObjectSet<StoreTEST > to point to System.Data.Objects.ObjectSet<Store> in PROD without chg of code?

    meaning  System.Data.Objects.ObjectSet<StoreTEST >  should be  System.Data.Objects.ObjectSet<Store> ;

    Thx


    raj

    Tuesday, April 24, 2012 3:21 PM

Answers

  • Hi Raj;

    Sorry but I mus-understood this statement, "now this StoreTEST  table becomes Store table (without TEST at the end) in PROD environment with identical schema (PK and FK same etc);", I took it to mean that at the end the two schema's were identical but in the end there are table names that don't have the same name even though they may have the same columns, so schema's are not the same and therefore you can not do it.

    The schema of the two databases must be identical.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by RajParmar Tuesday, April 24, 2012 8:39 PM
    Tuesday, April 24, 2012 7:25 PM

All replies

  • Hi Raj;

    You should have a section in the App.config / web.config that looks like this:

    <connectionStrings>
      <add name="NorthwindWithContactsEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=RAPTOR\SQLEXPRESS;initial catalog=NorthwindWithContacts;integrated security=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>


    near the end of the add node you will find a section called provider connection string which contains the name of the server you are connecting to. Change the attribute data source= to the server you wish to connect to.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Tuesday, April 24, 2012 5:30 PM
  • Irt did not work, aftre I changed the Datasource to prod;

    error>> {"Invalid object name 'dbo.StoreTest'."}

    since PROD has only Store ;


    raj

    Tuesday, April 24, 2012 6:51 PM
  • System.Data.Objects.ObjectSet<StoreTest> storesCollection = new MyEntities().StoreTests;

    storesCollection = context.StoreTests;


    raj

    Tuesday, April 24, 2012 6:53 PM
  • Hi Raj;

    Sorry but I mus-understood this statement, "now this StoreTEST  table becomes Store table (without TEST at the end) in PROD environment with identical schema (PK and FK same etc);", I took it to mean that at the end the two schema's were identical but in the end there are table names that don't have the same name even though they may have the same columns, so schema's are not the same and therefore you can not do it.

    The schema of the two databases must be identical.

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    • Marked as answer by RajParmar Tuesday, April 24, 2012 8:39 PM
    Tuesday, April 24, 2012 7:25 PM
  • yes the table names are different but schemas are same;

    You have answered it. Thx.

    I was thinking of Virtual ObjectSet that can be overridden at runtime;

    for prod it would be System.Data.Objects.ObjectSet<Store>

    and for Dev it would be System.Data.Objects.ObjectSet<StoreTEST>

    using ObjectQuery<T>

    but it cant be done; 


    raj

    Tuesday, April 24, 2012 8:42 PM
  • htere is tight coupling here.. it would have been nice to have this feature same schema under different environment but table names are different;

    raj

    Tuesday, April 24, 2012 8:43 PM