Example #1
0
        public MainWindowViewModel()
        {
            GenericManager          = new GenericManager();
            BusinessWorkflowManager = new BusinessWorkflowManager(GenericManager);
            FileService             = new FileService();
            JsonParserService       = new JsonParserService();
            StoredMetadataModel     = new StoredMetadataSchemaService(JsonParserService, FileService);
            StoredDataModel         = new StoredGenericValuesService(JsonParserService, FileService);

            var model = new MetadataModel();

            model.AddEntity(new Project());
            model.AddEntity(new Domain());
            model.AddEntity(new Setting());
            model.AddEntity(new Models.Environment());
            model.AddEntity(new Schema());
            model.AddEntity(new Property());
            model.AddEntity(new Model());
            model.AddEntity(new Repository());
            model.AddEntity(new UseCase());
            model.AddEntity(new RepositoryMethod());


            model.AddRelationship(new Project(), new Domain());
            model.AddRelationship(new Project(), new Setting());
            model.AddRelationship(new Project(), new Models.Environment());
            model.AddRelationship(new Domain(), new Schema());
            model.AddRelationship(new Schema(), new Property());
            model.AddRelationship(new Schema(), new Model());
            model.AddRelationship(new Schema(), new Repository());
            model.AddRelationship(new Schema(), new UseCase());
            model.AddRelationship(new Repository(), new RepositoryMethod());

            model.AddManyTwoManyRelationship(new Property(), new Model());
            model.AddManyTwoManyRelationship(new Property(), new Schema(), "ReferencedSchema");

            GenericManager.InitializeModel(model);

            GenericManager.CreateHandler                = new CreateService(StoredDataModel);
            GenericManager.UpdateHandler                = new UpdateService(StoredDataModel);
            GenericManager.DeleteHandler                = new DeleteService(StoredDataModel, model, true);
            GenericManager.RetrieveHandler              = new RetrieveService(StoredDataModel);
            GenericManager.RetrieveAllHandler           = new RetrieveAllService(StoredDataModel);
            GenericManager.AssociateHandler             = new AssociateService(StoredDataModel);
            GenericManager.DisassociateHandler          = new DisassociateService(StoredDataModel);
            GenericManager.RetrieveAllAssociatedHandler = new RetrieveAllAssociatedService(StoredDataModel);

            GenericManager.OnCustomModuleContentEditRequested += GenericManager_OnCustomModuleContentEditRequested;
        }