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;
        }
Example #2
0
        public MainControlViewModel()
        {
            GenericManager          = new GenericManager();
            BusinessWorkflowManager = new BusinessWorkflowManager(GenericManager);
            FileService             = new FileService();
            JsonParserService       = new JsonParserService();
            StoredMetadataModel     = new StoredMetadataSchemaService(JsonParserService, FileService);
            StoredDataModel         = new StoredGenericValuesService(JsonParserService, FileService);
            BusinessEventManager    = new BusinessEventManager();
            var currentModel = StoredMetadataModel
                               .GetStoredData()
                               .CompleteModel();

            GenericManager.InitializeModel(currentModel);

            GenericManager.CreateHandler                = new CreateService(StoredDataModel);
            GenericManager.UpdateHandler                = new UpdateService(StoredDataModel);
            GenericManager.DeleteHandler                = new DeleteService(StoredDataModel);
            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);

            Entities      = GenericManager.Model.Entities.OrderBy(k => k.DisplayName).ToList();
            Relationships = GenericManager.Model.Relationships;

            CurrentEntity = !string.IsNullOrEmpty(currentModel.MainEntity)
                 ? Entities.First(k => k.LogicalName == currentModel.MainEntity)
                 : Entities.First();
            CurrentViewType = ViewType.List;

            BusinessEventManager.OnCreateRequested += BusinessEventManager_OnCreateRequested;
            BusinessEventManager.OnUpdatedEntity   += BusinessEventManager_OnUpdatedEntity;
            BusinessEventManager.OnSelectedEntity  += BusinessEventManager_OnSelectedEntity;
            BusinessEventManager.OnDeletedEntity   += BusinessEventManager_OnDeletedEntity;
            InitializeCommands();
        }