Ejemplo n.º 1
0
 public XRootNamespace(EntityContainer root)
 {
     _doc        = new XDocument(root.Untyped);
     _rootObject = root;
 }
        private EntityContainer.AssociationSetLocalType.EndLocalType CreateConceptualAssociationSetEnd(IEntity entity, string role, EntityContainer.AssociationSetLocalType set, EntityContainer.AssociationSetLocalType.EndLocalType otherEnd = null)
        {
            var end = otherEnd == null ?
                set.Ends.Where(e => e.Role.Equals(entity.EntityKeyName) || e.Role.Equals(role)).FirstOrDefault() :
                set.Ends.Where(e => !e.Equals(otherEnd)).FirstOrDefault();

            if (end == null)
            {
                end = new EntityContainer.AssociationSetLocalType.EndLocalType() { Role = role };
                set.Ends.Add(end);
            }

            end.Role = role;
            end.EntitySet = ResolveEntityMappedName(entity.EntityKey(), entity.Name);

            return end;
        }