Adding new entity very slow RRS feed

  • Question

  • Hi to all,

    I'm developing a VS2010 solution building Db with POCO classes (manually, without template) on EF 4.3

    My structure is made by more than 600 classes/tables linked themselves by key (i.e 1to1 or 1toM).

    Now, I'm going to do first insert :

    using (ReportContext ctx = new ReportContext())

    and in ReportContext() class I check one time only if model is compatible, moreover there's the OnModelCreating method with the Mapping of all classes.

    The problem is that the first insert is veeeeeeery slow, particulary the SaveChanges() method, and sometimes I got exp "Thread was being aborted".

    What it depends on and how can I solve?

    This problem seems linked with this , but I hope that from January 09 until now MS Team has some progress.

    Tnx in advance

    Thursday, October 25, 2012 2:12 PM

All replies

  • Any idea, pls?


    Friday, October 26, 2012 7:34 AM
  • Hi Nero.mancini,

    Welcome to the MSDN forum.

    Do you use Entity Framework 5? If don’t, please try to upgrade to Entity Framework 5.

    Do you use SQLCE as your database?

    Also, I recommend you check if change tracking is disabled: http://msdn.microsoft.com/en-us/library/cc280462.aspx

    Could you please show us some related code snippet about checking if model is compatible?

    Please use SQL Profiler to track the T SQL generated by Entity framework and directly use the same T SQL query to check if it is very slow or not.

    Have a nice day.

    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    Monday, October 29, 2012 8:05 AM