public OscriptApplicationModelProvider(ApplicationInstance appObject,
                                               IApplicationRuntime framework,
                                               IFileProvider sourceProvider,
                                               IAuthorizationPolicyProvider authPolicyProvider)
        {
            _fw                  = framework;
            _app                 = appObject;
            _scriptsProvider     = sourceProvider;
            _policyProvider      = authPolicyProvider;
            _classAttribResolver = new ClassAttributeResolver();

            if (!_fw.Engine.DirectiveResolvers.Any(x => x is ClassAttributeResolver))
            {
                _fw.Engine.DirectiveResolvers.Add(_classAttribResolver);
            }

            FillDefaultMappers();
        }
예제 #2
0
        public OscriptApplicationModelProvider(ApplicationInstance appObject,
                                               IApplicationRuntime framework,
                                               IFileProvider sourceProvider,
                                               IAuthorizationPolicyProvider authPolicyProvider)
        {
            _fw                      = framework;
            _app                     = appObject;
            _scriptsProvider         = sourceProvider;
            _controllersMethodOffset = ScriptedController.GetOwnMethodsRelectionOffset();
            _policyProvider          = authPolicyProvider;
            _classAttribResolver     = new ClassAttributeResolver();

            if (_fw.Engine.DirectiveResolver is DirectiveMultiResolver resolvers)
            {
                if (!resolvers.Any(x => x is ClassAttributeResolver))
                {
                    resolvers.Add(_classAttribResolver);
                }
            }
        }