Example #1
0
        public static async Task <ContentOperationContext> CreateAsync(
            IContentRepository contentRepository,
            ContentDomainObject content,
            ContentCommand command,
            IAppProvider appProvider,
            ISchemaProvider schemas,
            IScriptEngine scriptEngine,
            IAssetRepository assetRepository,
            Func <string> message)
        {
            var taskForApp    = appProvider.FindAppByIdAsync(command.AppId.Id);
            var taskForSchema = schemas.FindSchemaByIdAsync(command.SchemaId.Id);

            await Task.WhenAll(taskForApp, taskForSchema);

            var context = new ContentOperationContext();

            context.appEntity         = taskForApp.Result;
            context.assetRepository   = assetRepository;
            context.contentRepository = contentRepository;
            context.content           = content;
            context.command           = command;
            context.message           = message;
            context.schemaEntity      = taskForSchema.Result;
            context.scriptEngine      = scriptEngine;

            return(context);
        }
Example #2
0
        private async Task <ContentOperationContext> CreateContext(ContentCommand command, ContentDomainObject content, Func <string> message)
        {
            var operationContext =
                await ContentOperationContext.CreateAsync(
                    contentRepository,
                    content,
                    command,
                    appProvider,
                    assetRepository,
                    scriptEngine,
                    message);

            return(operationContext);
        }
Example #3
0
        public static async Task <ContentOperationContext> CreateAsync(
            IContentRepository contentRepository,
            ContentDomainObject content,
            ContentCommand command,
            IAppProvider appProvider,
            IAssetRepository assetRepository,
            IScriptEngine scriptEngine,
            Func <string> message)
        {
            var(appEntity, schemaEntity) = await appProvider.GetAppWithSchemaAsync(command.AppId.Name, command.SchemaId.Id);

            var context = new ContentOperationContext();

            context.appEntity         = appEntity;
            context.assetRepository   = assetRepository;
            context.contentRepository = contentRepository;
            context.content           = content;
            context.command           = command;
            context.message           = message;
            context.schemaEntity      = schemaEntity;
            context.scriptEngine      = scriptEngine;

            return(context);
        }