This project has moved. For the latest updates, please go here.

When creating anonymous objects, Id is being populating with the full url (rather than guid)

Aug 14, 2014 at 1:27 PM
Hi there,

I am trying to create an anonymous type through EntitySet<T> collection, however the the Id property in the anonymous object is the fully quailed url rather than the guid (even though I did set [Identifier] attribute correctly).

so when accessing the Id directly through the object:
var temp= unitOfWork.GetRepository<IPerson>().GetAll().First().Id
I am getting the guid as required

but when creating anonymous object by either of the following:
var list = from p in unitOfWork.GetRepository<IPerson>().GetAll()
                           select new { Id = p.Id, FirstName = p.FirstName, LastName = p.LastName };

 OR

var list = unitOfWork.GetRepository<IPerson>().GetAll().Select(p => new { Id = p.Id, FirstName = p.FirstName, LastName = p.LastName });
and then accessing the Id:
var temp1= list.First().Id
I am getting the url (http://example.org/people#bd5f3caa-0152-4074-bb06-faa2f5704b82)

Any ideas how I can avoid it?

Thanks?