var configDictionary = ConfigLoader.Load("xxx.xml")
.Descendants("Entry")
.Select(e => new
{
ID = e.Attribute("Code").Value,
EntityID = e.Attribute("EntityID") != null ? e.Attribute("EntityID").Value : null,
ContextID = e.Attribute("ContextID").Value,
})
.ToDictionary(a => a.ID);