Пример #1
0
 protected void Init(IInstanceContext context, IAppIdentity appId, ILog parentLog)
 {
     Init(parentLog);
     Context = context;
     ZoneId  = appId.ZoneId;
     AppId   = appId.AppId;
 }
        public dynamic DialogSettings(IInstanceContext context, ContextBuilderBase contextBuilder, int appId)
        {
            IApp app = null;

            // if we have an appid (we don't have it in an install-new-apps-scenario) check permissions
            if (appId != 0 && appId != Eav.Constants.AppIdEmpty)
            {
                var appAndPerms = new MultiPermissionsApp().Init(context, GetApp(appId, null), Log);
                if (!appAndPerms.ZoneIsOfCurrentContextOrUserIsSuper(out var error))
                {
                    throw HttpException.PermissionDenied(error);
                }
                app = appAndPerms.App;
            }

            var cb = contextBuilder.InitApp(app?.ZoneId, app);

            return(new
            {
                // TODO: Deprecate PARAMS these properties as soon as old UI is gone
                //IsContent = app?.AppGuid == "Default",
                //Language = psCurrent.CultureCode,
                //LanguageDefault = psCurrent.DefaultLanguage,
                //AppPath = app?.Path,
                //GettingStartedUrl = cb.GettingStartedUrl(),
                // END TODO
                Context = cb.Get(Ctx.All),
            });
        }
Пример #3
0
        /// <summary>
        /// Preprocess security / context, then get the item based on an passed in method,
        /// ...then process/finish
        /// </summary>
        /// <returns></returns>
        internal Dictionary <string, object> GetOne(IInstanceContext context, IBlock ctxBlock, string contentType, Func <EntityApi, IEntity> getOne, string appPath)
        {
            Log.Add($"get and serialize after security check type:{contentType}, path:{appPath}");
            // if app-path specified, use that app, otherwise use from context
            var appIdentity = AppFinder.GetAppIdFromPathOrContext(appPath, ctxBlock);

            var entityApi = new EntityApi(appIdentity.AppId, true, Log);

            var itm       = getOne(entityApi);
            var permCheck = new MultiPermissionsItems().Init(context, GetApp(appIdentity.AppId, ctxBlock), itm, Log);

            if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            // in case draft wasn't allow, get again with more restricted permissions
            if (!permCheck.EnsureAny(GrantSets.ReadDraft))
            {
                entityApi = new EntityApi(appIdentity.AppId, false, Log);
                itm       = getOne(entityApi);
            }

            return(InitEavAndSerializer(appIdentity.AppId, ctxBlock?.EditAllowed ?? false).Convert(itm));
        }
Пример #4
0
        private IView TryToGetTemplateBasedOnUrlParams(IInstanceContext context, CmsRuntime cms)
        {
            var wrapLog = Log.Call <IView>("template override - check");

            if (context.Page.Parameters == null)
            {
                return(wrapLog("no params", null));
            }

            var urlParameterDict = context.Page.Parameters.ToDictionary(pair => pair.Key?.ToLower() ?? "", pair =>
                                                                        $"{pair.Key}/{pair.Value}".ToLower());

            var allTemplates = /*new CmsRuntime(App, Log, UserMayEdit, false)*/ cms.Views.GetAll();

            foreach (var template in allTemplates.Where(t => !string.IsNullOrEmpty(t.UrlIdentifier)))
            {
                var desiredFullViewName = template.UrlIdentifier.ToLower();
                if (desiredFullViewName.EndsWith("/.*"))   // match details/.* --> e.g. details/12
                {
                    var keyName = desiredFullViewName.Substring(0, desiredFullViewName.Length - 3);
                    if (urlParameterDict.ContainsKey(keyName))
                    {
                        return(wrapLog("template override - found:" + template.Name, template));
                    }
                }
                else if (urlParameterDict.ContainsValue(desiredFullViewName)) // match view/details
                {
                    return(wrapLog("template override - found:" + template.Name, template));
                }
            }

            return(wrapLog("template override - none", null));
        }
Пример #5
0
        internal IEnumerable <Dictionary <string, object> > GetItems(IInstanceContext context, string contentType, IBlock ctxBlock, string appPath = null)
        {
            var wrapLog = Log.Call($"get entities type:{contentType}, path:{appPath}");

            // if app-path specified, use that app, otherwise use from context
            var appIdentity = AppFinder.GetAppIdFromPathOrContext(appPath, ctxBlock);

            // get the app - if we have the context from the request, use that, otherwise generate full app
            var app = ctxBlock == null
                ? Factory.Resolve <Apps.App>().Init(appIdentity, Log)
                : GetApp(appIdentity.AppId, ctxBlock);

            // verify that read-access to these content-types is permitted
            var permCheck = new MultiPermissionsTypes().Init(context, app, contentType, Log);

            if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            var result = new EntityApi(appIdentity.AppId, permCheck.EnsureAny(GrantSets.ReadDraft), Log)
                         .GetEntities(contentType)
                         ?.ToList();

            wrapLog("found: " + result?.Count);
            return(result);
        }
Пример #6
0
        public IEnumerable <ViewDto> ViewUsage(IInstanceContext context, int appId, Guid guid,
                                               Func <List <IView>, List <BlockConfiguration>, IEnumerable <ViewDto> > finalBuilder)
        {
            var wrapLog = Log.Call <IEnumerable <ViewDto> >($"{appId}, {guid}");

            // extra security to only allow zone change if host user
            var permCheck = new MultiPermissionsApp().Init(context, GetApp(appId, null), Log);

            if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            var cms = new CmsRuntime(appId, Log, true);
            // treat view as a list - in case future code will want to analyze many views together
            var views = new List <IView> {
                cms.Views.Get(guid)
            };

            var blocks = cms.Blocks.AllWithView();

            Log.Add($"Found {blocks.Count} content blocks");

            var result = finalBuilder(views, blocks);

            return(wrapLog("ok", result));
        }
Пример #7
0
        public void DoInsidePublishing(IInstanceContext context, Action <VersioningActionInfo> action)
        {
            var instanceId = context.Container.Id;
            var userId     = (context.User as DnnUser).UnwrappedContents.UserID;
            var enabled    = IsEnabled(instanceId);

            Log.Add($"DoInsidePublishing(module:{instanceId}, user:{userId}, enabled:{enabled})");
            if (enabled)
            {
                var moduleVersionSettings = new DnnPagePublishing.ModuleVersions(instanceId, Log);

                // Get an new version number and submit it to DNN
                // The submission must be made every time something changes, because a "discard" could have happened
                // in the meantime.
                TabChangeTracker.Instance.TrackModuleModification(
                    moduleVersionSettings.ModuleInfo,
                    moduleVersionSettings.IncreaseLatestVersion(),
                    userId
                    );
            }

            var versioningActionInfo = new VersioningActionInfo();

            action.Invoke(versioningActionInfo);
            Log.Add("/DoInsidePublishing");
        }
Пример #8
0
 public ContentBlockBackend Init(IInstanceContext context, IBlock block, ILog parentLog)
 {
     Log.LinkTo(parentLog);
     _block      = block;
     _context    = context;
     _cmsManager = new CmsManager(_block.App, Log);
     return(this);
 }
Пример #9
0
 public AppViewPickerBackend Init(IInstanceContext context, IBlock block, ILog parentLog)
 {
     Log.LinkTo(parentLog);
     _context    = context;
     _block      = block;
     _cmsRuntime = _block.App == null ? null : new CmsRuntime(_block.App, Log, true, false);
     return(this);
 }
Пример #10
0
        /// <summary>
        /// Create a module-content block
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="parentLog">a parent-log; can be null but where possible you should wire one up</param>
        ///// <param name="overrideParams">optional override parameters</param>
        public BlockFromModule Init(IInstanceContext ctx, ILog parentLog)
        {
            Init(ctx, ctx.Container.BlockIdentifier, parentLog);
            var wrapLog = Log.Call <BlockFromModule>();

            IsContentApp = ctx.Container.IsPrimary;
            CompleteInit <BlockFromModule>(null, ctx.Container.BlockIdentifier, ctx.Container.Id);
            return(wrapLog("ok", this));
        }
Пример #11
0
        internal Dictionary <string, object> CreateOrUpdate(IInstanceContext context, IBlock ctxBlock, string contentType, Dictionary <string, object> newContentItem, int?id = null, string appPath = null)
        {
            Log.Add($"create or update type:{contentType}, id:{id}, path:{appPath}");
            // if app-path specified, use that app, otherwise use from context
            var appIdentity = AppFinder.GetAppIdFromPathOrContext(appPath, ctxBlock);

            // Check that this ID is actually of this content-type,
            // this throws an error if it's not the correct type
            var itm = id == null
                ? null
                : new EntityApi(appIdentity.AppId, true, Log).GetOrThrow(contentType, id.Value);

            var ok = itm == null
                ? new MultiPermissionsTypes()
                     .Init(context, GetApp(appIdentity.AppId, ctxBlock), contentType, Log)
                     .EnsureAll(Grants.Create.AsSet(), out var error)
                : new MultiPermissionsItems().Init(context, GetApp(appIdentity.AppId, ctxBlock), itm, Log)
                     .EnsureAll(Grants.Update.AsSet(), out error);

            if (!ok)
            {
                throw HttpException.PermissionDenied(error);
            }

            // Convert to case-insensitive dictionary just to be safe!
            newContentItem = new Dictionary <string, object>(newContentItem, StringComparer.OrdinalIgnoreCase);

            // Now create the cleaned up import-dictionary so we can create a new entity
            var cleanedNewItem = new AppContentEntityBuilder(Log)
                                 .CreateEntityDictionary(contentType, newContentItem, appIdentity.AppId);

            var userName = context.User.IdentityToken;

            // try to create
            // 2020-08-21 disabled publish check, don't think it's relevant in API mode
            // var publish = Factory.Resolve<IPagePublishing>().Init(Log);
            // var enablePublish = publish.IsEnabled(context.Container.Id);
            var currentApp = GetApp(appIdentity.AppId, ctxBlock);

            //Factory.Resolve<Apps.App>().Init(appIdentity,
            //    ConfigurationProvider.Build(false, false,
            //        ctxBlockBuilder?.Block.Data.Configuration.LookUps), true, Log);

            if (id == null)
            {
                var entity = currentApp.Data.Create(contentType, cleanedNewItem, userName);
                id = entity.EntityId;
            }
            else
            {
                currentApp.Data.Update(id.Value, cleanedNewItem, userName);
            }

            return(InitEavAndSerializer(appIdentity.AppId, ctxBlock?.EditAllowed ?? false)
                   .Convert(currentApp.Data.List.One(id.Value)));
        }
Пример #12
0
        public static IContainer Build(IInstanceContext options)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(options).As <IInstanceContext>();

            builder.RegisterModule <ContinuousRunnerModule>();

            return(builder.Build());
        }
Пример #13
0
        public static IContainer Build(IInstanceContext options)
        {
            var builder = new ContainerBuilder();

            builder.RegisterInstance(options).As<IInstanceContext>();

            builder.RegisterModule<ContinuousRunnerModule>();

            return builder.Build();
        }
Пример #14
0
        internal IView PickView(IBlock block, IView configView, IInstanceContext context, CmsRuntime cms)
        {
            //View = configView;
            // skip on ContentApp (not a feature there) or if not relevant or not yet initialized
            if (block.IsContentApp || block.App == null)
            {
                return(configView);
            }

            // #2 Change Template if URL contains the part in the metadata "ViewNameInUrl"
            var viewFromUrlParam = TryToGetTemplateBasedOnUrlParams(context, cms);

            return(viewFromUrlParam ?? configView);
        }
Пример #15
0
        public IAdaptorHost Create(IServiceContext serviceContext, IInstanceContext instanceContext, ServiceToken token)
        {
            // Environment.SetEnvironmentVariable("GRPC_VERBOSITY", "DEBUG");
            // Environment.SetEnvironmentVariable("GRPC_TRACE", "all");
            // global::Grpc.Core.GrpcEnvironment.SetLogger(new global::Grpc.Core.Logging.ConsoleLogger());

            if (serviceContext is ServerContextBase serverContextBase)
            {
                return(new Grpc.AdaptorServerHost(serverContextBase, instanceContext));
            }
            else if (serviceContext is ClientContextBase clientContextBase)
            {
                return(new Grpc.AdaptorClientHost(clientContextBase, instanceContext));
            }
            throw new NotImplementedException();
        }
Пример #16
0
        public void DoInsidePublishing(IInstanceContext context, Action <VersioningActionInfo> action)
        {
            var containerId = context.Container.Id;
            var userId      = 0;
            var enabled     = IsEnabled(containerId);

            Log.Add($"DoInsidePublishing(module:{containerId}, user:{userId}, enabled:{enabled})");
            if (enabled)
            {
                /* ignore */
            }

            var versioningActionInfo = new VersioningActionInfo();

            action.Invoke(versioningActionInfo);
            Log.Add("/DoInsidePublishing");
        }
Пример #17
0
        public dynamic Usage(IInstanceContext context, IApp app, Guid guid)
        {
            var permCheck = new MultiPermissionsApp().Init(context, app, Log);

            if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            var appData       = permCheck.App.Data;
            var item          = appData.List.One(guid);
            var relationships = item.Relationships.AllRelationships;

            // var result = relationships.Select(r => new EntityInRelationDto(r.))
            // todo: don't forget Metadata relationships
            return(null);
        }
Пример #18
0
        PublicQuery(IInstanceContext context, string appPath, string name, string stream, IBlock block)
        {
            var wrapLog = Log.Call($"path:{appPath}, name:{name}");

            if (string.IsNullOrEmpty(name))
            {
                throw HttpException.MissingParam(nameof(name));
            }
            var appIdentity = AppFinder.GetAppIdFromPath(appPath);
            var queryApp    = Factory.Resolve <Apps.App>().Init(appIdentity,
                                                                ConfigurationProvider.Build(false, false), false, Log);

            // now just run the default query check and serializer
            var result = BuildQueryAndRun(queryApp, name, stream, false, context, Log, block?.EditAllowed ?? false);

            wrapLog(null);
            return(result);
        }
Пример #19
0
        public IEnumerable <EntityForPickerDto> GetAvailableEntities(IInstanceContext ctx, int appId, string[] items, string contentTypeName, int?dimensionId)
        {
            // do security check
            var permCheck = string.IsNullOrEmpty(contentTypeName)
                ? new MultiPermissionsApp().Init(ctx, GetApp(appId, null), Log)
                : new MultiPermissionsTypes().Init(ctx, GetApp(appId, null), contentTypeName, Log);

            if (!permCheck.EnsureAll(GrantSets.ReadSomething, out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            // maybe in the future, ATM not relevant
            var withDrafts = permCheck.EnsureAny(GrantSets.ReadDraft);

            return(new Eav.WebApi.EntityPickerApi(Log)
                   .GetAvailableEntities(appId, items, contentTypeName, withDrafts, dimensionId));
        }
Пример #20
0
        internal void Delete(IInstanceContext context, IBlock ctxBlock, string contentType, Guid guid, string appPath)
        {
            Log.Add($"delete guid:{guid}, type:{contentType}, path:{appPath}");
            // if app-path specified, use that app, otherwise use from context
            var appIdentity = AppFinder.GetAppIdFromPathOrContext(appPath, ctxBlock);

            var entityApi = new EntityApi(appIdentity.AppId, true, Log);
            var itm       = entityApi.GetOrThrow(contentType == "any" ? null : contentType, guid);

            var permCheck = new MultiPermissionsItems().Init(context, GetApp(appIdentity.AppId, ctxBlock), itm, Log);

            if (!permCheck.EnsureAll(Grants.Delete.AsSet(), out var error))
            {
                throw HttpException.PermissionDenied(error);
            }

            entityApi.Delete(itm.Type.Name, guid);
        }
        private static async Task RunAsync(IInstanceContext options)
        {
            var logger = LogManager.GetCurrentClassLogger();

            using (var consoleReader = new ConsoleReader())
                using (var container = Container.Build(options))
                {
                    consoleReader.Start();

                    LoadScriptsAsync(container);

                    var watcher = container.Resolve <IWatcher>();

                    using (var watchHandle = watcher.Watch())
                    {
                        logger.Info("Entering run loop; press enter to stop; press R to force complete re-run");

                        var stopping = false;

                        while (!stopping)
                        {
                            var key = consoleReader.Read(TimeSpan.FromSeconds(.5d));
                            if (key.HasValue == false)
                            {
                                continue;
                            }

                            switch (key.Value)
                            {
                            case '\r':
                            case '\n':
                                stopping = true;
                                break;

                            case 'R':
                            case 'r':
                                await RunTestsAsync(container).ConfigureAwait(false);

                                break;
                            }
                        }
                    }
                }
        }
Пример #22
0
        // TODO: shouldn't be part of ContentGroupController any more, as it's generic now
        public void Replace(IInstanceContext context, Guid guid, string part, int index, int entityId, bool add = false)
        {
            var wrapLog    = Log.Call($"target:{guid}, part:{part}, index:{index}, id:{entityId}");
            var versioning = Factory.Resolve <IPagePublishing>().Init(Log);

            void InternalSave(VersioningActionInfo args)
            {
                var cms    = new CmsManager(_app, Log);
                var entity = cms.AppState.List.One(guid);

                if (entity == null)
                {
                    throw new Exception($"Can't find item '{guid}'");
                }

                // correct casing of content / listcontent for now - TODO should already happen in JS-Call
                if (entity.Type.Name == BlocksRuntime.BlockTypeName)
                {
                    if (string.Equals(part, ViewParts.Content, OrdinalIgnoreCase))
                    {
                        part = ViewParts.Content;
                    }
                    if (string.Equals(part, ViewParts.ListContent, OrdinalIgnoreCase))
                    {
                        part = ViewParts.ListContent;
                    }
                }

                if (add)
                {
                    cms.Entities.FieldListAdd(entity, new[] { part }, index, new int?[] { entityId }, cms.EnablePublishing);
                }
                else
                {
                    cms.Entities.FieldListReplaceIfModified(entity, new[] { part }, index, new int?[] { entityId },
                                                            cms.EnablePublishing);
                }
            }

            // use dnn versioning - this is always part of page
            //var block = GetBlock();
            versioning.DoInsidePublishing(context, InternalSave);
            wrapLog(null);
        }
Пример #23
0
        private static async Task RunAsync(IInstanceContext options)
        {
            var logger = LogManager.GetCurrentClassLogger();

            using (var consoleReader = new ConsoleReader())
            using (var container = Container.Build(options))
            {
                consoleReader.Start();

                LoadScriptsAsync(container);

                var watcher = container.Resolve<IWatcher>();

                using (var watchHandle = watcher.Watch())
                {
                    logger.Info("Entering run loop; press enter to stop; press R to force complete re-run");

                    var stopping = false;

                    while (!stopping)
                    {
                        var key = consoleReader.Read(TimeSpan.FromSeconds(.5d));
                        if (key.HasValue == false)
                        {
                            continue;
                        }

                        switch (key.Value)
                        {
                            case '\r':
                            case '\n':
                                stopping = true;
                                break;
                            case 'R':
                            case 'r':
                                await RunTestsAsync(container).ConfigureAwait(false);
                                break;
                        }
                    }
                }
            }
        }
Пример #24
0
        // TODO: part should be handed in with all the relevant names! atm it's "content" in the content-block scenario
        public bool Reorder(IInstanceContext context, Guid guid, List <EntityInListDto> list, string part = null)
        {
            Log.Add($"list for:{guid}, items:{list?.Count}");
            if (list == null)
            {
                throw new ArgumentNullException(nameof(list));
            }

            _publishing.DoInsidePublishing(context, args =>
            {
                var cms    = new CmsManager(_app, Log);
                var entity = cms.Read.AppState.List.One(guid);

                var sequence = list.Select(i => i.Index).ToArray();
                var fields   = part == ViewParts.ContentLower ? ViewParts.ContentPair : new[] { part };
                cms.Entities.FieldListReorder(entity, fields, sequence, cms.EnablePublishing);
            });

            return(true);
        }
Пример #25
0
        public JsContextEnvironment(string systemRootUrl, IInstanceContext ctx, IBlock block)
        {
            WebsiteId = ctx.Tenant.Id;

            WebsiteUrl = "//" + ctx.Tenant.Url + "/";

            PageId  = ctx.Page.Id;
            PageUrl = ctx.Page.Url;

            InstanceId = ctx.Container.Id;

            SxcVersion = Settings.Version.ToString();

            SxcRootUrl = systemRootUrl;

            var userMayEdit = block?.EditAllowed ?? false;

            IsEditable = userMayEdit;
            parameters = block?.Context.Page.Parameters;
        }
Пример #26
0
        BuildQueryAndRun(IApp app, string name, string stream, bool includeGuid, IInstanceContext context, ILog log,
                         bool userMayEdit)
        {
            var wrapLog = log.Call($"name:{name}, withModule:{context.Container.Id}");
            var query   = app.GetQuery(name);

            if (query == null)
            {
                var msg = $"query '{name}' not found";
                wrapLog(msg);
                throw new HttpExceptionAbstraction(HttpStatusCode.NotFound, msg, "query not found");
            }

            var permissionChecker = Factory.Resolve <AppPermissionCheck>().ForItem( // new DnnPermissionCheck().ForItem(
                context,                                                            // new DnnContext(new DnnTenant(), new DnnContainer().Init(module, log), new DnnUser()),
                appIdentity: app,
                targetItem: query.Definition.Entity, parentLog: log);
            var readExplicitlyAllowed = permissionChecker.UserMay(GrantSets.ReadSomething);

            var isAdmin = context.User.IsAdmin;

            //module != null && DotNetNuke.Security.Permissions
            //              .ModulePermissionController.CanAdminModule(module);

            // Only return query if permissions ok
            if (!(readExplicitlyAllowed || isAdmin))
            {
                var msg = $"Request not allowed. User does not have read permissions for query '{name}'";
                wrapLog(msg);
                throw new HttpExceptionAbstraction(HttpStatusCode.Unauthorized, msg, "Request not allowed");
            }

            var serializer = new DataToDictionary(userMayEdit)
            {
                WithGuid = includeGuid
            };
            var result = serializer.Convert(query, stream?.Split(','));

            wrapLog(null);
            return(result);
        }
Пример #27
0
        public IInstanceContext CreateInstanceContext(IConnection connectionSession)
        {
            IInstanceContext result = null;

            if (_instanceMode == InstanceMode.Single)
            {
                if (_singleton == null)
                {
                    lock (this)
                    {
                        if (_singleton == null)
                        {
                            _singleton = NewInstanceContext();
                        }
                    }
                }
                result = _singleton;
            }
            else if (_instanceMode == InstanceMode.PerCall)
            {
                result = NewInstanceContext();
            }
            else if (_instanceMode == InstanceMode.PerConnection)
            {
                try
                {
                    result = _contexts[connectionSession];
                }
                catch
                {
                    connectionSession.SessionEnded -= OnSessionEnded;
                    connectionSession.SessionEnded += OnSessionEnded;
                    result = _contexts.AddOrUpdate(connectionSession, NewInstanceContext(), (s, d) => d);
                }
            }
            return(result);
        }
Пример #28
0
 public PeerCollection(IServiceContext serviceContext, IInstanceContext instanceContext)
 {
     this.serviceContext  = serviceContext;
     this.instanceContext = instanceContext;
 }
Пример #29
0
 private void OnInstanceFactorySessionInstanceRemoved(IInstanceContextFactory factory, IInstanceContext context)
 {
     this.SessionInstanceRemove?.Invoke((TService)context.Service);
 }
Пример #30
0
 private void OnInstanceFactoryInstanceCreate(IInstanceContextFactory factory, IInstanceContext context)
 {
     this.ServiceInstanceCreated?.Invoke((TService)context.Service);
 }
Пример #31
0
        public MockFile(IInstanceContext instanceContext)
        {
            _instanceContext = instanceContext;

            _collection = new TempFileCollection(_instanceContext.ScriptsRoot.FullName);
        }
Пример #32
0
 /// <summary>
 /// Gets the behavior value asynchronously.
 /// </summary>
 /// <param name="context">          The context.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>
 /// A promise of the behavior value.
 /// </returns>
 Task<object> IBehaviorRule.GetValueAsync(IInstanceContext context, CancellationToken cancellationToken)
 {
     return Task.FromResult((object)true);
 }
Пример #33
0
 /// <summary>
 /// Gets the behavior value asynchronously.
 /// </summary>
 /// <param name="context">          The context.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>
 /// A promise of the behavior value.
 /// </returns>
 public Task<bool> GetValueAsync(IInstanceContext context, CancellationToken cancellationToken)
 {
     return Task.FromResult(true);
 }
Пример #34
0
 /// <summary>
 /// Gets a value asynchronously indicating whether the rule may be applied or not.
 /// </summary>
 /// <param name="context">          The context.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>
 /// A promise of a value indicating whether the rule may be applied or not.
 /// </returns>
 public Task<bool> CanApplyAsync(IInstanceContext context, CancellationToken cancellationToken = new CancellationToken())
 {
     return Task.FromResult(true);
 }
Пример #35
0
 public AdaptorClientHost(IServiceContext serviceContext, IInstanceContext instanceContext)
 {
     this.serviceContext  = serviceContext;
     this.instanceContext = instanceContext;
     this.serviceHosts    = serviceContext.ServiceHosts;
 }