public void AddRoleInfoEntity(RoleInfoEntity newItem) { var results = from r in this.context.CreateQuery<RoleInfoEntity>(entitySetName) where r.RowKey == newItem.RowKey && r.PartitionKey == newItem.PartitionKey select r; this.context.IgnoreResourceNotFoundException = true; var roleInfoEntity = results.FirstOrDefault<RoleInfoEntity>(); if (roleInfoEntity != null) this.context.DeleteObject(roleInfoEntity); this.context.AddObject(entitySetName, newItem); this.context.SaveChanges(); this.context.IgnoreResourceNotFoundException = false; }
public void AddRoleInfoEntity(RoleInfoEntity newItem) { this.context.AddObject(entitySetName, newItem); this.context.SaveChanges(); }