locked
Can ExecuteCommand and ExecuteQuery<Q> execute Datasource specific commands RRS feed

  • Question

  • Hi All,

    I want to insert or delete bulk data using EF 4.0 so after searching a while i found ExecuteCommand and ExecuteQuery<Q> methods which execute native SQL (Datasource specfic commands to perform this task) O.K. fine but

    My problem is I want my EF context to be independent from Data source i.e. I wish (and may be should) to support that my application will run on SQL Server and ORACLE databases..?

    So what should i do to achieve this GOAL...?

    i.e. Executing that kind of commands that have some differences in T-SQL and Oracle commands..?  

     

    Wednesday, January 11, 2012 9:56 AM

Answers

  • Hi,

    What is the data source ? IMO EF is not really suitable for that. I would look at http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx and I believe the Oracle provider has something similar.

    You'll perhaps have though to hide this behind your own interface as I believe there is nothing standard for bulk copy operations. Finally a regular ADO.NET group could be more usefull as its IMO beyond the scope of EF.


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
    • Proposed as answer by Allen_MSDN Monday, January 16, 2012 2:11 AM
    • Marked as answer by Allen_MSDN Wednesday, January 18, 2012 1:46 AM
    Saturday, January 14, 2012 3:38 PM

All replies

  • Hi Raza Haider,

    Welcome to MSDN Forum.

    Forgive my dull, I'm not clear about your meaning. What's the meaning of make EF context independent from data source?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 13, 2012 2:51 AM
  • Allen i mean to say EF = Entity Framework with different data sources i.e. SQL SERVER or ORACLE etc..
    Saturday, January 14, 2012 12:05 PM
  • Hi,

    What is the data source ? IMO EF is not really suitable for that. I would look at http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx and I believe the Oracle provider has something similar.

    You'll perhaps have though to hide this behind your own interface as I believe there is nothing standard for bulk copy operations. Finally a regular ADO.NET group could be more usefull as its IMO beyond the scope of EF.


    Please always mark whatever response solved your issue so that the thread is properly marked as "Answered".
    • Proposed as answer by Allen_MSDN Monday, January 16, 2012 2:11 AM
    • Marked as answer by Allen_MSDN Wednesday, January 18, 2012 1:46 AM
    Saturday, January 14, 2012 3:38 PM