public ModelRepository GetReferential(FileInfo directoryPath)
        {
            var fullname = directoryPath.Directory.FullName;

            if (!_referentials.TryGetValue(fullname, out ModelRepository model))
            {
                _referentials.Add(fullname, (model = new Bb.Galileo.Files.ModelRepository(fullname, new Diag())));
                model.Initialize();
            }

            return(model);
        }
Beispiel #2
0
        public FileRepository(string folder, IDiagnostic diagnostic, ModelRepository modelRepository)
        {
            this._folder     = new DirectoryInfo(folder);
            this._diagnostic = diagnostic;
            this.Models      = modelRepository;

            _watchers = new List <FileWatcher>()
            {
                new FileWatcher(this, "*.schema.json"),
                new FileWatcher(this, "*.defs.json"),
                new FileWatcher(this, "*.entities.json"),
                new FileWatcher(this, "*.links.json"),
            };

            this._items = new Dictionary <string, FileModel>();
        }
Beispiel #3
0
        public IEnumerable <IBase> GetReferentials(ModelRepository rep)
        {
            QueryFilter query = new QueryFilter();

            Type type = null;

            switch (this.Kind)
            {
            case ElementEnum.Entity:
                type = typeof(ReferentialEntity);
                if (!string.IsNullOrEmpty(this.Identifier))
                {
                    query.AddName(this.Identifier);
                }

                if (!string.IsNullOrEmpty(this.TypeName))
                {
                    query.AddTypeName(this.TypeName);
                }
                break;

            case ElementEnum.Relationship:
                type = typeof(ReferentialRelationship);
                if (!string.IsNullOrEmpty(this.Identifier))
                {
                    query.AddName(this.Identifier);
                }

                if (!string.IsNullOrEmpty(this.TypeName))
                {
                    query.AddTypeName(this.TypeName);
                }
                break;

            case ElementEnum.RelationshipDefinition:
                type = typeof(RelationshipDefinition);
                if (!string.IsNullOrEmpty(this.TypeName))
                {
                    query.AddName(this.TypeName);
                }
                break;

            case ElementEnum.EntityDefinition:
                type = typeof(EntityDefinition);
                if (!string.IsNullOrEmpty(this.TypeName) && this.TypeName != "*")
                {
                    query.AddName(this.TypeName);
                }
                break;

            case ElementEnum.RestrictionDefinition:
            default:
                break;
            }

            if (type != null)
            {
                var source = rep.Get(type, query).ToList();
                return(source);
            }

            return(new IBase[0]);
        }
Beispiel #4
0
 public TypesIndex(ModelRepository parent)
 {
     this._parent = parent;
     _items       = new Dictionary <string, TargetListIndex>();
 }
Beispiel #5
0
 public SchemaValidator(ModelRepository modelRepository)
 {
     this._parent = modelRepository;
 }
Beispiel #6
0
 public ModelIndex(ModelRepository parent, string targetName)
 {
     this._parent    = parent;
     this.TargetName = targetName;
     _items          = new Dictionary <string, ReferentialBase>();
 }
Beispiel #7
0
 public SchemaManager(ModelRepository modelRepository)
 {
     this._parent = modelRepository;
 }
Beispiel #8
0
 public Loader(ModelRepository parent)
 {
     this._parent = parent;
 }