Пример #1
0
        protected override void OnStart()
        {
            base.OnStart();
            ContentTypes.SetContentType(ScriptEngines.HandleExtension, "text/plain");
            ContentTypes.SetContentType(ScriptEngines.WindowExtension, "text/html");
            scriptEngines = new ScriptEngines(Site, Config);

            var assembly = Assembly.Load("netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51");

            scriptEngines.AddSysReferencedAssembly(assembly.Location);

            scriptEngines.AddSysReferencedAssembly(Assembly.GetExecutingAssembly().Location);
            scriptEngines.AddSysReferencedAssembly(typeof(Processor).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(ReflexHelper).Assembly.Location);

            scriptEngines.AddSysReferencedAssembly(typeof(object).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Uri).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Linq.Enumerable).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Data.SqlDbType).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Data.SqlClient.SqlConnection).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Data.SqlClient.SqlCommand).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.ServiceModel.ServiceHost).Assembly.Location);
            scriptEngines.AddSysReferencedAssembly(typeof(System.Runtime.Serialization.DataContractAttribute).Assembly.Location);
            foreach (var referencedAssemblyName in typeof(Framework.BaseDisposed).Assembly.GetReferencedAssemblies())
            {
                var referencedAssembly = Assembly.Load(referencedAssemblyName);
                scriptEngines.AddSysReferencedAssembly(referencedAssembly.Location);
            }

            scriptEngines.Start();

            var domain = scriptEngines.ApplicationDomain;
            var app    = domain.CreateApplication();

            app.Site    = Site;
            app.Setting = new ApplicationSetting(Site);

            Application.Current = app;
            Application.Current.Startup();
        }