コード例 #1
0
        /// <summary>
        /// Instanciate information about AspMvc Application.
        /// </summary>
        /// <param name="appAspNetPath"></param>
        /// <param name="typeSetList"></param>
        /// <param name="isAspNetCoreWindows"></param>
        /// <returns></returns>
        public AspMvcInfo(string appAspNetPath, IList <AssemblySet> typeSetList, bool isAspNetCoreWindows = false)
        {
            this.AssemblyResolver = new AssemblyResolver(Path.GetDirectoryName(appAspNetPath));
            Assembly asp_net = ReflectionLoader.LoadFrom(appAspNetPath, this.AssemblyResolver);

            InitializeCore(asp_net, typeSetList, this.AssemblyResolver, isAspNetCoreWindows);
        }
コード例 #2
0
        /// <summary>
        /// System.Net.Http.
        /// </summary>
        /// <param name="assemblyResolver"></param>
        public AssemblyInfoWrapperBaseWebApi_NetHttp(AssemblyResolver assemblyResolver)
        {
            #region "_Ass_NetHttp"

            this._Assembly = ReflectionLoader.Load(Name, assemblyResolver);

            foreach (var t in this._Assembly.ExportedTypes)
            {
                if (this._Type_HttpResponseMessage == null && t.FullName == this.Namespace + ".HttpResponseMessage")
                {
                    this._Type_HttpResponseMessage = t;
                }

                if (this.Type_HttpMethod == null && t.FullName == this.Namespace + ".HttpMethod")
                {
                    this.Type_HttpMethod = t;
                }

                if (this._Type_HttpResponseMessage != null && this.Type_HttpMethod != null)
                {
                    break;
                }
            }


            #endregion
        }
コード例 #3
0
        public static CompilerState ReflectionLoaded()
        {
            var loader  = new ReflectionLoader();
            var context = new Context();

            loader.Discover(context, typeof(CompilerStateFixtures).Assembly);
            return(new CompilerState(context));
        }
コード例 #4
0
        /// <summary>
        /// //Microsoft.AspNetCore.Mvc.Abstractions.dll
        /// </summary>
        /// <param name="assemblyResolver"></param>
        public AssemblyInfoWrapperBaseWebApi_Abstractions(AssemblyResolver assemblyResolver)
        {
            this._Assembly = ReflectionLoader.Load(Name, assemblyResolver);

            {
                string name = (this.Namespace + "." + "IActionResult");
                this.Type_IHttpActionResult = this._Assembly.GetType(name, false);
            }
        }
コード例 #5
0
        /// <summary>
        /// Microsoft.AspNetCore.Mvc
        /// </summary>
        /// <param name="assemblyResolver"></param>
        public AssemblyInfoWrapperBaseMvc_ViewFeatures(AssemblyResolver assemblyResolver)
        {
            this._Assembly = ReflectionLoader.Load(Name, assemblyResolver);

            {
                string name = (this.Namespace + ".ViewResult");
                this.Type_ViewResult = this._Assembly.GetType(name, false);
            }
        }
コード例 #6
0
        /// <summary>
        /// //Microsoft.AspNetCore.Mvc.Formatters.Json.dll
        /// </summary>
        /// <param name="assemblyResolver"></param>
        public AssemblyInfoWrapperBaseMvc_FormattersJson(AssemblyResolver assemblyResolver)
        {
            this._Assembly = ReflectionLoader.Load(Name, assemblyResolver);

            {
                string name = (this.Namespace + ".JsonResult");
                this.Type_JsonResult = this._Assembly.GetType(name, false);
            }
        }
コード例 #7
0
        /// <summary>
        /// Microsoft.AspNetCore.Mvc
        /// </summary>
        /// <param name="assemblyResolver"></param>
        public AssemblyInfoWrapperBaseMvc(AssemblyResolver assemblyResolver)
        {
            this._Assembly = ReflectionLoader.Load(Name, assemblyResolver);



            {
                string name = (this.Namespace + ".ActionResult");
                this.Type_ActionResult = this._Assembly.GetType(name, false);
            }

            {
                string name = (this.Namespace + ".ActionNameAttribute");
                this._Type_ActionNameAttribute = this._Assembly.GetType(name, false);
            }
        }
コード例 #8
0
        public void Loader_Correctly_Initialised()
        {
            //Use own dll. Test class and test custom attribute below
            var assembly = System.Reflection.Assembly.GetExecutingAssembly();
            IReflectionLoader reflectionLoader = new ReflectionLoader();

            reflectionLoader.Initialise(assembly.Location, "Xrm.Framework.CI.PowerShell.Cmdlets.Test.TestCustomAttribute");

            Assert.AreEqual("Xrm.Framework.CI.PowerShell.Cmdlets.Test.dll", reflectionLoader.AssemblyName);
            Assert.AreEqual(1, reflectionLoader.ClassNames.Count);
            Assert.AreEqual("Xrm.Framework.CI.PowerShell.Cmdlets.Test.TestClass1", reflectionLoader.ClassNames[0]);
            Assert.AreEqual(1, reflectionLoader.Constructors.Count);
            Assert.AreEqual(4, reflectionLoader.Constructors[0].Count);
            Assert.AreEqual(1, (int)reflectionLoader.Constructors[0]["i1"]);
            Assert.AreEqual("a", (string)reflectionLoader.Constructors[0]["s1"]);
            Assert.AreEqual(2, (int)reflectionLoader.Constructors[0]["i2"]);
            Assert.AreEqual("b", (string)reflectionLoader.Constructors[0]["s2"]);
        }
コード例 #9
0
 /// <summary>
 /// ex: System.Web.Http or Microsoft.AspNetCore.Mvc
 /// </summary>
 /// <param name="assemblyResolver"></param>
 public AssemblyInfoWrapperBaseWebApi_WebHttp(AssemblyResolver assemblyResolver)
 {
     this.InitializeCore(ReflectionLoader.Load(Name, assemblyResolver));
 }