views:

36

answers:

1

We are using ADO.Net DataService ( .Net Framework 4.0, Visual Studio 2010). We have Select, Insert, Update and Delete operations.

  • For Selecting we have queries like

School school = _context.School.Expand("Address, ContactPerson, ContactPerson/Details......").Where(S => S.Name == "xxx").SingleOrDefault();

  • For Inserting

    _context.AddToSchool(school); _contextSaveChanges();

    address.SchoolCode = school.Code; //// Address have relation with school

    _context.AddToAddress(address);

//Right now we don't have any Cascade Insert operation.

  • For update we are using like this

    //Each time while updating, we are creating the object, We are facing the issues like "Context already tracking the entity" or "context is not tracked". This is worst Practice :(

    _context = new DataContext(......)

    AttachObject("Schools", school); _context.UpdateObject(school); _context.SaveChanges();

    Code snippet which is used for Attach the object while updating.

    private void AttachObject(string entitySetName, object entity) {

    if (!_container.Entities.Where(entities => entities.Entity == entity).Any())
    {
        _container.AttachTo(entitySetName, entity);
    }
    

    }

  • For deleting

    //Right now we don't have any cascade delete operation.

Address address = _context.Address.where(A => A.Code == deleteAddress.Code).SingleOrDefault();

_context.DeleteObject(address); _context.SaveChanges();

This is taking plenty of time even in local system. I'm scared of performance, this needs to be launched in separate server. Please tell me what is the best approach using "ADO.Net DATASERVICE"

I need the answer not Down Vote :)

EDIT : I checked with range of 5 Rows with column of 10, and nested table of 4. Even i can see UI freeze for single Row Update for 5 Seconds.

A: 

I wouldn't rule out the query just yet.

  1. What's the data size? A few hundred rows, a few million, or a few hundred million?
  2. Index and Disk performance?
  3. If it's a remote server, how's the connection?

Now the query

  1. Make sure you are not expanding duplicate data. Expand only what's needed.
  2. Check for other data types you are expanding, perhaps binary for Images etc.

Hope that helps.

Saif Khan
Its only local system, and its configuration is too good and row's in single digit. Its taking twice time than ADO.Net.
Mohanavel