tags:

views:

17

answers:

0

Hi,

I have a EnityName called Client and I need it's collection name Clients, it has to be generic so that I can get the EntitySetName from EntityName for any entity. It's exposed in the svc file but doesn't seem to be in the service proxy class. If I can do this then I can have a generic method like.

public void Add<T>(IEnumerable<T> entitySet)
{
    var myService = GetServiceContext();

    foreach (var entity in entitySet)
    {
        myService.AddObject(entity.GetType().Name -- NEEDS TO BE ENTITY SET NAME, entity);
    }

    myService.SaveChanges(SaveChangesOptions.Batch);

}

Thanks

Tobi