Example #1
0
        protected void Application_Start()
        {
            XmlConfigurator.Configure(); //Log4net registry.

            MvcWebConfig.Regist(() =>
            {
                AreaRegistration.RegisterAllAreas();
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                PermissionConfig.Regist();
                //设置member root的初始化密码
                var memberDataInit = GlobalInitializer.Get <MemberShipData>();
                /*if (memberDataInit != null)*/
                memberDataInit.AdminPassword = "******";
            },
                                typeof(HttpErrorsController),
                                Assembly.GetExecutingAssembly());


            PermissionConfig.Regist();
            ApplicationConfig.Register(OrnamentContext.Configuration);
            //Ornament setting
            //Registry the Provider to use Membership rule of asp.net.
            //Assembly auto config.

            InputBuilder.BootStrap();
            NotifyConfig.Register();

            MvcWebConfig.InitData();
        }
Example #2
0
        /// <summary>
        /// File-in and process the actions contained in the node.
        /// </summary>
        /// <param name="processor">Interchange format processor responsible for the processing context.</param>
        /// <param name="parseErrorSink">Error sink for reporting parse errors.</param>
        /// <param name="sourceCodeService">Source code service that can convert tokens to source code span and reports issues.</param>
        /// <returns>Return an interchange unit node for annotation, usually just self.</returns>
        public override InterchangeUnitNode FileIn(InterchangeFormatProcessor processor, IParseErrorSink parseErrorSink, ISourceCodeReferenceService sourceCodeService)
        {
            if (processor == null)
            {
                throw new ArgumentNullException("processor");
            }
            if (parseErrorSink == null)
            {
                throw new ArgumentNullException("parseErrorSink");
            }
            if (sourceCodeService == null)
            {
                throw new ArgumentNullException("sourceCodeService");
            }
            // ALL instance vars must be set. If one is missing, then source code bug, and
            //   InterchangeFormatParser.ParseGlobalInitialization() should have reported the error.
            if (this.GlobalName == null)
            {
                return(this);
            }

            // <globalValueInitialization> ::= <globalName> ’initializer’ <elementSeparator>
            //      <variableInitializer> <elementSeparator>
            // <variableInitializer> ::= <initializer definition>

            ISourceCodeReferenceService methodSourceCodeService;
            InitializerNode             initializer = processor.ParseInitializer(out methodSourceCodeService);

            if (initializer == null)
            {
                return(this); // Processor/Parser should have reported errors
            }
            if (!initializer.Accept(IronSmalltalk.Compiler.Visiting.ParseTreeValidatingVisitor.Current))
            {
                // We expect the parser to have reported the errors. Just in case, we do it once more to the installer.
                // Bad practice here is to use the 'processor.SourcePosition', but we don't have anything better :-/
                if (processor.ErrorSink != null)
                {
                    processor.ErrorSink.AddInterchangeError(processor.SourcePosition, processor.SourcePosition, "Invalid initializer source code.");
                }
                return(this);
            }

            RuntimeGlobalInitializerFactory factory = new RuntimeGlobalInitializerFactory(initializer, methodSourceCodeService, this.GlobalName.Value);

            GlobalInitializer definition = new GlobalInitializer(
                processor.CreateSourceReference(this.GlobalName.Value, this.GlobalName, sourceCodeService),
                sourceCodeService,
                methodSourceCodeService,
                factory);

            this.Definfition = definition;
            // This may fail, but we don't care. If failed, it reported the error through its error sink.
            processor.FileInProcessor.FileInGlobalInitializer(definition);

            return(this);
        }
        public static void InitData()
        {
            var wrapper = SessionManager.GetSessionWrapper();

            try
            {
                GlobalInitializer.BuildData();
                wrapper.Commit();
            }
            catch (Exception ex)
            {
                LogManager.GetLogger(typeof(MvcWebConfig)).Fatal("nhibernate update error.", ex);
                throw ex;
            }
            finally
            {
                wrapper.Close();
            }
        }
 bool IInterchangeFileInProcessor.FileInGlobalInitializer(GlobalInitializer initializer)
 {
     this.AddGlobalInitializer(initializer);
     return(true);
 }
Example #5
0
 public bool ValidateGlobalInitializer(GlobalInitializer definition, IDefinitionInstallerContext installer, ICodeValidationErrorSink errorSink)
 {
     return(((RuntimeGlobalInitializer)this.CreateInitializer(definition, installer)).Validate(installer.NameScope, this.GetErrorSink(errorSink)));
 }
 /// <summary>
 /// Add a global initializer definition to the installation context.
 /// </summary>
 /// <param name="initializer">Definition of the global initializer to be added.</param>
 public void AddGlobalInitializer(GlobalInitializer initializer)
 {
     this._initializers.Add(initializer);
 }