コード例 #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
ファイル: Relationship.cs プロジェクト: j-prox/blueprint41
        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
        static private FunctionalId?GetFunctionalId(DatastoreModel parent, string name, string label, string?prefix)
        {
            FunctionalId?functionalId = null;

            if (prefix != null)
            {
                if (string.IsNullOrWhiteSpace(prefix))
                {
                    throw new NotSupportedException($"The prefix cannot be empty or blank for entity '{name}'.");
                }

                functionalId = parent.FunctionalIds.FirstOrDefault(item => item.Label == label);
                if (functionalId == null)
                {
                    functionalId = parent.FunctionalIds.New(label, prefix);
                }
            }
            return(functionalId);
        }
コード例 #7
0
 internal Interface(DatastoreModel parent, string name)
 {
     Parent = parent;
     Name   = name;
     Guid   = parent.GenerateGuid(name);
 }
コード例 #8
0
 internal DataMigrationScope(DatastoreModel model)
 {
     Model = model;
 }
コード例 #9
0
 internal Entity(DatastoreModel parent, string name, string label, string?prefix, Entity?inherits)
     : this(parent, name, label, GetFunctionalId(parent, name, label, prefix), inherits)
 {
 }
コード例 #10
0
ファイル: Enumeration.cs プロジェクト: j-prox/blueprint41
 internal Enumeration(DatastoreModel parent, string name)
 {
     Parent = parent;
     Name   = name;
     Guid   = parent?.GenerateGuid(name) ?? Guid.Empty;
 }