protected override EntityRelationElement Create()
        {
            if (string.IsNullOrEmpty(_name))
            {
                throw new InvalidOperationException("The relation name was not specified.");
            }

            if (!_cardinality.HasValue)
            {
                throw new InvalidOperationException("The relation cardinality was not specified.");
            }

            if (_targetEntityElement == null && _targetEntityElementConfig == null)
            {
                throw new InvalidOperationException("The relation target was not specified.");
            }

            AddFeatures(new EntityRelationCardinalityFeature(_cardinality.Value, _targetEntityElement ?? _targetEntityElementConfig));

            if (_containsTarget)
            {
                AddFeatures(new EntityRelationContainmentFeature());
            }

            return(new EntityRelationElement(UriExtensions.AsUri(_name).AsIdentity(), Features));
        }
 public EntityElementBuilder HasKey(params string[] propertyNames)
 {
     foreach (var propertyName in propertyNames)
     {
         _keyNames.Add(UriExtensions.AsUri(propertyName));
     }
     return(this);
 }
        protected override EnumTypeElement Create()
        {
            if (string.IsNullOrEmpty(_name))
            {
                throw new InvalidOperationException("The entity name was not specified.");
            }

            return(new EnumTypeElement(UriExtensions.AsUri(_name).AsIdentity(), _enumMembers));
        }
        protected override StructuralModelElement Create()
        {
            if (string.IsNullOrEmpty(_name))
            {
                throw new InvalidOperationException("The model name was not specified.");
            }

            IEnumerable <EntityElement>    entities;
            IEnumerable <IMetadataElement> types;

            ProcessElements(out entities, out types);

            Childs(types.ToArray());

            return(new StructuralModelElement(UriExtensions.AsUri(_name).AsIdentity(), entities, Features));
        }
        protected override EntityPropertyElement Create()
        {
            if (string.IsNullOrEmpty(_name))
            {
                throw new InvalidOperationException("The property name was not specified.");
            }

            if (_typeElement == null)
            {
                throw new InvalidOperationException("The property type was not specified");
            }

            if (_isNullable)
            {
                AddFeatures(new EntityPropertyNullableFeature(true));
            }

            return(new EntityPropertyElement(UriExtensions.AsUri(_name).AsIdentity(), _typeElement, Features));
        }
 public EntityElementBuilder Name(string name)
 {
     _entityId = UriExtensions.AsUri(name);
     return(this);
 }
Exemplo n.º 7
0
 public BoundedContextElementBuilder Map(string conceptualEntityName, string storeEntityName)
 {
     _entityMap.Add(UriExtensions.AsUri(conceptualEntityName), UriExtensions.AsUri(storeEntityName));
     return(this);
 }