コード例 #1
0
        public void Set(IAppProvider plugin, string key, string value)
        {
            Plugin pl = sys.InstalledPlugins.First(p => Object.ReferenceEquals(p.PluginObj, plugin));

            using (var session = sys.GetDBSession())
            {
                Configuration.Plugin pConf = session.Load<Configuration.Plugin>(pl.DbId);
                pConf.Settings[key] = value;
                session.SaveChanges();
            }
        }
コード例 #2
0
        public string Get(IAppProvider plugin, string key)
        {
            Plugin pl = sys.InstalledPlugins.First(p => Object.ReferenceEquals(p.PluginObj, plugin));

            using (var session = sys.GetDBSession())
            {
                Configuration.Plugin pConf = session.Load<Configuration.Plugin>(pl.DbId);
                if (!pConf.Settings.ContainsKey(key))
                    return null;
                return pConf.Settings[key];
            }
        }
コード例 #3
0
ファイル: Server.cs プロジェクト: taucode/taucode
        internal Server(IAppProvider appProvider, IAuthorizer authorizer, IListener listener, ISerializer serializer)
        {
            // todo1[ak] check args

            _lock = new object();

            if (appProvider == null)
            {
                throw new ArgumentNullException("appProvider");
            }

            _appProvider = appProvider;
            _authorizer = authorizer;
            _listener = listener;
            _serializer = serializer;

            _channels = new List<IChannel>();
        }
コード例 #4
0
ファイル: ContentEnricher.cs プロジェクト: jrlost/squidex
        public ContentEnricher(IEnumerable <IContentEnricherStep> steps, IAppProvider appProvider)
        {
            this.steps = steps;

            this.appProvider = appProvider;
        }
コード例 #5
0
ファイル: AppResolver.cs プロジェクト: julienM77/squidex
        public AppResolver(IAppProvider appProvider)
        {
            Guard.NotNull(appProvider, nameof(appProvider));

            this.appProvider = appProvider;
        }
コード例 #6
0
 public LocalCopy(IAppProvider source, ITransferTarget target, ISteamApplication app) : base(source, target, app)
 {
 }
コード例 #7
0
        public static Task <IEnumerable <ValidationError> > ValidateAsync(Guid appId, RuleTrigger action, IAppProvider appProvider)
        {
            Guard.NotNull(action);
            Guard.NotNull(appProvider);

            var visitor = new RuleTriggerValidator(x => appProvider.GetSchemaAsync(appId, x));

            return(action.Accept(visitor));
        }
コード例 #8
0
ファイル: GuardSchema.cs プロジェクト: mallickhruday/squidex
        public static Task CanCreate(CreateSchema command, IAppProvider appProvider)
        {
            Guard.NotNull(command, nameof(command));

            return(Validate.It(() => "Cannot create schema.", async e =>
            {
                if (!command.Name.IsSlug())
                {
                    e(Not.ValidSlug("Name"), nameof(command.Name));
                }
                else if (await appProvider.GetSchemaAsync(command.AppId.Id, command.Name) != null)
                {
                    e("A schema with the same name already exists.");
                }

                if (command.Fields?.Count > 0)
                {
                    var fieldIndex = 0;
                    var fieldPrefix = string.Empty;

                    foreach (var field in command.Fields)
                    {
                        fieldIndex++;
                        fieldPrefix = $"Fields[{fieldIndex}]";

                        if (!field.Partitioning.IsValidPartitioning())
                        {
                            e(Not.Valid("Partitioning"), $"{fieldPrefix}.{nameof(field.Partitioning)}");
                        }

                        ValidateField(e, fieldPrefix, field);

                        if (field.Nested?.Count > 0)
                        {
                            if (field.Properties is ArrayFieldProperties)
                            {
                                var nestedIndex = 0;
                                var nestedPrefix = string.Empty;

                                foreach (var nestedField in field.Nested)
                                {
                                    nestedIndex++;
                                    nestedPrefix = $"{fieldPrefix}.Nested[{nestedIndex}]";

                                    if (nestedField.Properties is ArrayFieldProperties)
                                    {
                                        e("Nested field cannot be array fields.", $"{nestedPrefix}.{nameof(nestedField.Properties)}");
                                    }

                                    ValidateField(e, nestedPrefix, nestedField);
                                }
                            }
                            else if (field.Nested.Count > 0)
                            {
                                e("Only array fields can have nested fields.", $"{fieldPrefix}.{nameof(field.Partitioning)}");
                            }

                            if (field.Nested.Select(x => x.Name).Distinct().Count() != field.Nested.Count)
                            {
                                e("Fields cannot have duplicate names.", $"{fieldPrefix}.Nested");
                            }
                        }
                    }

                    if (command.Fields.Select(x => x.Name).Distinct().Count() != command.Fields.Count)
                    {
                        e("Fields cannot have duplicate names.", nameof(command.Fields));
                    }
                }
            }));
        }
コード例 #9
0
        public MongoContentCollection(IMongoDatabase database, IJsonSerializer serializer, IAppProvider appProvider)
            : base(database)
        {
            this.appProvider = appProvider;

            this.serializer = serializer;
        }
コード例 #10
0
 public QueryAsStream(DataConverter converter, IAppProvider appProvider)
     : base(converter)
 {
     this.appProvider = appProvider;
 }
コード例 #11
0
        public static async Task <ResolvedComponents> GetComponentsAsync(this IAppProvider appProvider, ISchemaEntity schema,
                                                                         CancellationToken ct = default)
        {
            Dictionary <DomainId, Schema>?result = null;

            var appId = schema.AppId.Id;

            async Task ResolveWithIdsAsync(IField field, ReadonlyList <DomainId>?schemaIds)
            {
                if (schemaIds == null)
                {
                    return;
                }

                foreach (var schemaId in schemaIds)
                {
                    if (schemaId == schema.Id)
                    {
                        result ??= new Dictionary <DomainId, Schema>();
                        result[schemaId] = schema.SchemaDef;
                    }
                    else if (result == null || !result.TryGetValue(schemaId, out _))
                    {
                        var resolvedEntity = await appProvider.GetSchemaAsync(appId, schemaId, false, ct);

                        if (resolvedEntity != null)
                        {
                            result ??= new Dictionary <DomainId, Schema>();
                            result[schemaId] = resolvedEntity.SchemaDef;

                            await ResolveSchemaAsync(resolvedEntity);
                        }
                    }
                }
            }

            async Task ResolveArrayAsync(IArrayField arrayField)
            {
                foreach (var nestedField in arrayField.Fields)
                {
                    await ResolveFieldAsync(nestedField);
                }
            }

            async Task ResolveFieldAsync(IField field)
            {
                switch (field)
                {
                case IField <ComponentFieldProperties> component:
                    await ResolveWithIdsAsync(field, component.Properties.SchemaIds);

                    break;

                case IField <ComponentsFieldProperties> components:
                    await ResolveWithIdsAsync(field, components.Properties.SchemaIds);

                    break;

                case IArrayField arrayField:
                    await ResolveArrayAsync(arrayField);

                    break;
                }
            }

            async Task ResolveSchemaAsync(ISchemaEntity schema)
            {
                foreach (var field in schema.SchemaDef.Fields)
                {
                    await ResolveFieldAsync(field);
                }
            }

            await ResolveSchemaAsync(schema);

            if (result == null)
            {
                return(ResolvedComponents.Empty);
            }

            return(new ResolvedComponents(result));
        }
コード例 #12
0
 public void Set(IAppProvider plugin, string key, object value)
 {
     Set(plugin, key, value.ToString());
 }
コード例 #13
0
 public AppModuleScriptCreator(IAppProvider appProvider)
 {
     AppProvider = appProvider;
 }
コード例 #14
0
 public AppClientsController(ICommandBus commandBus, IAppProvider appProvider)
     : base(commandBus)
 {
     this.appProvider = appProvider;
 }
コード例 #15
0
 public MongoContentPublishedCollection(IMongoDatabase database, IJsonSerializer serializer, IAppProvider appProvider)
     : base(database, serializer, appProvider, "State_Content_Published")
 {
 }
コード例 #16
0
        public DynamicContentWorkflow(IScriptEngine scriptEngine, IAppProvider appProvider)
        {
            this.scriptEngine = scriptEngine;

            this.appProvider = appProvider;
        }
コード例 #17
0
ファイル: HomeController.cs プロジェクト: osuritz/Tungsten
 /// <summary>
 /// Initializes a new instance of the <see cref="HomeController"/> class.
 /// </summary>
 /// <param name="appProvider">The app provider.</param>
 public HomeController(IAppProvider appProvider)
 {
     this.AppProvider = appProvider;
 }
コード例 #18
0
        public static Task <IEnumerable <ValidationError> > ValidateAsync(DomainId appId, RuleTrigger trigger, IAppProvider appProvider)
        {
            Guard.NotNull(trigger, nameof(trigger));
            Guard.NotNull(appProvider, nameof(appProvider));

            var visitor = new RuleTriggerValidator(x => appProvider.GetSchemaAsync(appId, x));

            return(trigger.Accept(visitor));
        }
コード例 #19
0
ファイル: AppResolver.cs プロジェクト: pushrbx/squidex
 public AppResolver(IAppProvider appProvider)
 {
     this.appProvider = appProvider;
 }
コード例 #20
0
 public AppApiController(IAppProvider appProvider)
 {
     AppProvider = appProvider;
 }
コード例 #21
0
        public EnrichWithSchemaIdCommandMiddleware(IAppProvider appProvider, IActionContextAccessor actionContextAccessor)
        {
            this.appProvider = appProvider;

            this.actionContextAccessor = actionContextAccessor;
        }
コード例 #22
0
 public AppLanguagesController(ICommandBus commandBus, IAppProvider appProvider)
     : base(commandBus)
 {
     this.appProvider = appProvider;
 }
コード例 #23
0
        public DefaultWorkflowsValidator(IAppProvider appProvider)
        {
            Guard.NotNull(appProvider, nameof(appProvider));

            this.appProvider = appProvider;
        }
コード例 #24
0
 public QueryByQuery(IAppProvider appProvider)
 {
     this.appProvider = appProvider;
 }
コード例 #25
0
        public QueryContentsByIds(IJsonSerializer serializer, IAppProvider appProvider)
        {
            this.serializer = serializer;

            this.appProvider = appProvider;
        }
コード例 #26
0
        public QueryContentsByIds(DataConverter converter, IAppProvider appProvider)
        {
            this.converter = converter;

            this.appProvider = appProvider;
        }
コード例 #27
0
 public DefaultWorkflowsValidator(IAppProvider appProvider)
 {
     this.appProvider = appProvider;
 }
コード例 #28
0
 public QueryByQuery(DataConverter dataConverter, IAppProvider appProvider)
     : base(dataConverter)
 {
     this.appProvider = appProvider;
 }
コード例 #29
0
 public AppApiFilter(IAppProvider appProvider)
 {
     this.appProvider = appProvider;
 }
コード例 #30
0
        public RolePermissionsProvider(IAppProvider appProvider)
        {
            Guard.NotNull(appProvider, nameof(appProvider));

            this.appProvider = appProvider;
        }
コード例 #31
0
            public ReferenceTag(IContentQueryService contentQueryService, IAppProvider appProvider)
            {
                this.contentQueryService = contentQueryService;

                this.appProvider = appProvider;
            }
コード例 #32
0
ファイル: SchemasSearchSource.cs プロジェクト: jrlost/squidex
        public SchemasSearchSource(IAppProvider appProvider, IUrlGenerator urlGenerator)
        {
            this.appProvider = appProvider;

            this.urlGenerator = urlGenerator;
        }
コード例 #33
0
 public SchemasController(ICommandBus commandBus, IAppProvider appProvider)
     : base(commandBus)
 {
     this.appProvider = appProvider;
 }
コード例 #34
0
 public ContentOperationContext(IAppProvider appProvider, IEnumerable <IValidatorsFactory> factories, IScriptEngine scriptEngine)
 {
     this.appProvider  = appProvider;
     this.factories    = factories;
     this.scriptEngine = scriptEngine;
 }
コード例 #35
0
ファイル: JinnHelper.cs プロジェクト: taucode/taucode
 public static IServer CreateServer(IAppProvider appProvider, IAuthorizer authorizer, IListener listener, ISerializer serializer)
 {
     Server srv = new Server(appProvider, authorizer, listener, serializer);
     return srv;
 }
コード例 #36
0
ファイル: FriendViewModel.cs プロジェクト: truboxl/GamePipe
 public RemoteSteamApp(ISteamApplication receivedData, IAppProvider provider)
 {
     _appInfo  = receivedData;
     _provider = provider;
 }