Пример #1
0
        internal Entity(DatastoreModel parent, string name, string label, FunctionalId?functionalId, Entity?inherits)
        {
            Properties = new PropertyCollection(this);

            Parent     = parent;
            Name       = name;
            IsAbstract = false;
            IsVirtual  = false;
            Guid       = parent.GenerateGuid(name);

            Inherits = inherits;

            Parent.Labels.New(label);
            Label = Parent.Labels[label];

            if (inherits?.FunctionalId != null && functionalId != null)
            {
                throw new InvalidOperationException($"The entity '{name}' already inherited a functional id '{(inherits?.FunctionalId ?? functionalId).Prefix} ({(inherits?.FunctionalId ?? functionalId).Label})', you cannot assign another one.");
            }

            this.functionalId = functionalId;

            key        = new Lazy <Property>(delegate() { return(GetPropertiesOfBaseTypesAndSelf().SingleOrDefault(x => x.IsKey)); }, true);
            nodeType   = new Lazy <Property>(delegate() { return(GetPropertiesOfBaseTypesAndSelf().SingleOrDefault(x => x.IsNodeType)); }, true);
            rowVersion = new Lazy <Property>(delegate() { return(GetPropertiesOfBaseTypesAndSelf().SingleOrDefault(x => x.IsRowVersion)); }, true);

            Parent.SubModels["Main"].AddEntityInternal(this);
        }
Пример #2
0
        internal Relationship(DatastoreModel parent, string name, string?neo4JRelationshipType, Entity?inEntity, Interface?inInterface, Entity?outEntity, Interface?outInterface)
        {
            if (inEntity is null && inInterface is null)
            {
                throw new ArgumentNullException("You cannot have both the inEntity and the inInterface be empty.");
            }

            if (outEntity is null && outInterface is null)
            {
                throw new ArgumentNullException("You cannot have both the outEntity and the outInterface be empty.");
            }

            if (inEntity != null && inInterface != null)
            {
                throw new ArgumentException("You cannot have both the inEntity and the inInterface set at the same time.");
            }

            if (outEntity != null && outInterface != null)
            {
                throw new ArgumentException("You cannot have both the outEntity and the outInterface set at the same time.");
            }

            Parent                = parent;
            RelationshipType      = RelationshipType.None;
            Name                  = ComputeAliasName(name, neo4JRelationshipType, OutProperty);
            Neo4JRelationshipType = ComputeNeo4JName(name, neo4JRelationshipType, OutProperty);
            InInterface           = inInterface ?? new Interface(inEntity !);
            InProperty            = null;
            OutInterface          = outInterface ?? new Interface(outEntity !);
            OutProperty           = null;
            Guid                  = parent.GenerateGuid(name);
        }
Пример #3
0
 internal Enumeration(DatastoreModel parent, string name)
 {
     Parent            = parent;
     Name              = name;
     Guid              = parent?.GenerateGuid(name) ?? Guid.Empty;
     PropertyReference = null !;
 }
Пример #4
0
 internal FunctionalId(DatastoreModel parent, string label, string prefix, IdFormat format, int startFrom)
 {
     Label     = label;
     Prefix    = prefix;
     Format    = format;
     StartFrom = startFrom < 0 ? 0 : startFrom;
     Guid      = parent?.GenerateGuid(label) ?? Guid.Empty;
 }
Пример #5
0
 internal SubModel(DatastoreModel parent, string name, int chapter, bool isDraft, bool isLaboratory)
 {
     Parent       = parent;
     Name         = name;
     Chapter      = chapter;
     IsDraft      = isDraft;
     IsLaboratory = isLaboratory;
     Explanation  = null;
     Guid         = parent.GenerateGuid(name);
 }
Пример #6
0
 internal Interface(DatastoreModel parent, string name)
 {
     Parent = parent;
     Name   = name;
     Guid   = parent.GenerateGuid(name);
 }
Пример #7
0
 internal Enumeration(DatastoreModel parent, string name)
 {
     Parent = parent;
     Name   = name;
     Guid   = parent?.GenerateGuid(name) ?? Guid.Empty;
 }