當前位置: 首頁>>代碼示例>>C#>>正文


C# System.Resolver類代碼示例

本文整理匯總了C#中System.Resolver的典型用法代碼示例。如果您正苦於以下問題:C# Resolver類的具體用法?C# Resolver怎麽用?C# Resolver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Resolver類屬於System命名空間,在下文中一共展示了Resolver類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Configuration

        public void Configuration(IAppBuilder app) {
            var serializer = CreateJsonSerializer();
            GlobalHost.DependencyResolver.Register(typeof(JsonSerializer), () => serializer);
            var resolver = new Resolver(serializer);
            GlobalHost.DependencyResolver.Register(typeof(IParameterResolver), () => resolver);
            app.UseCors(new MyCorsOptions());
            app.Map("/api/get-upload-folders", builder => builder.Run(InvokeGames));
            app.Map("/signalr", map => {
                var debug =
#if DEBUG
                    true;
#else
                    false;
#endif

                var hubConfiguration = new HubConfiguration {
                    EnableDetailedErrors = debug
                };

                // Run the SignalR pipeline. We're not using MapSignalR
                // since this branch is already runs under the "/signalr"
                // path.
                map.RunSignalR(hubConfiguration);
            });
        }
開發者ID:MaHuJa,項目名稱:withSIX.Desktop,代碼行數:25,代碼來源:Startup.cs

示例2: TestCache

 public void TestCache() {
    Resolver<ContentType> resolver = new Resolver<ContentType>();
    resolver.Add(new ContentType("*.html", "text/html"));
    resolver.Add(new ContentType("*.jpg", "image/jpeg"));
    resolver.Add(new ContentType("/images/*", "image/jpeg"));
    resolver.Add(new ContentType("/log/**", "text/plain"));
    resolver.Add(new ContentType("*.exe", "application/octetstream"));
    resolver.Add(new ContentType("**.txt", "text/plain"));
    resolver.Add(new ContentType("/html/*", "text/html"));
    AssertEquals(7, resolver.Count);
    AssertEquals("image/jpeg", resolver.Resolve("image.jpg").Value);
    AssertEquals("text/plain", resolver.Resolve("README.txt").Value);
    int index = 0;
    for(int i = resolver.Count; i > 0; i--) {
       ContentType type = resolver[i - 1]; 
       if(type.Value.Equals("text/plain")) {
          index = i;
       }
    }
    resolver.RemoveAt(index);
    resolver.Add(new ContentType("*", "application/octetstream"));
    AssertEquals("application/octetstream", resolver.Resolve("README.txt").Value);
    AssertEquals("application/octetstream", resolver.Resolve("README.txt").Value);
    resolver.Add(new ContentType("README.*", "text/html"));
    resolver.Add(new ContentType("README.txt", "text/plain"));
    AssertEquals("text/plain", resolver.Resolve("README.txt").Value);
    AssertEquals("text/html", resolver.Resolve("README.jsp").Value);
 }
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:28,代碼來源:ResolverTest.cs

示例3: Resolver

        async Task IBoot.Run(CancellationToken token)
        {
            IResolver resolver = new Resolver(new[] {"CH.IoC."});
            _log = resolver.Resolve<ILog>();
            _log.Log(1, "Boot 1");

            var tasks =
                new[]
                    {
                        "isolated\\0",
                        "isolated\\1",
                        "isolated\\2"
                    }
                .Select(path => Run(path, token))
                .ToArray(); // force start

            foreach (var task in tasks)
            {
                try
                {
                    await task;
                }
                catch (Exception ex)
                {
                    _log.Log(2, "Boot 2: " + ex);
                }
            }

            while (!token.IsCancellationRequested)
            {
                await Task.Delay(10, token);
            }
        }
開發者ID:tanglebones,項目名稱:ch-ioc,代碼行數:33,代碼來源:Boot.cs

示例4: Resolver

 Task IIsolated.Run(System.Threading.CancellationToken token)
 {
     IResolver resolver = new Resolver(new[] {"CH.IoC."});
     var log = resolver.Resolve<ILog>();
     log.Log("Isolated 4.0.0.0");
     return Task.Delay(1, token);
 }
開發者ID:tanglebones,項目名稱:ch-ioc,代碼行數:7,代碼來源:Isolated.cs

示例5: UCPrintMonitor

        public UCPrintMonitor(User user, string moduleType)
        {
            InitializeComponent();
            this.resolver = new Resolver();
            this.resolver.UserCode = user.Code;
            this.resolver.ModuleType = moduleType;
            this.TheClientMgr = new ClientMgrWSSoapClient();
            this.dataGridView1.AutoGenerateColumns = false;

            this.resolver.Transformers = null;
            this.resolver.Result = string.Empty;
            this.resolver.BinCode = string.Empty;
            this.resolver.Code = string.Empty;
            this.resolver.CodePrefix = string.Empty;
            this.cacheReceiptNotes = new List<ReceiptNote>();

            //timer1_Tick(this, null);

            #region Printer
            foreach (string fPrinterName in LocalPrinter.GetLocalPrinters())
            {
                this.comboBoxPrint1.Items.Add(fPrinterName);
                this.comboBoxPrint2.Items.Add(fPrinterName);
                this.comboBoxPrint3.Items.Add(fPrinterName);
                this.comboBoxPrint4.Items.Add(fPrinterName);
                this.comboBoxPrint5.Items.Add(fPrinterName);
            }
            //this.comboBoxPrint1.SelectedItem = Settings.Default.DefaultPrintName1;
            #endregion
        }
開發者ID:Novthirteen,項目名稱:yfkey-scms,代碼行數:30,代碼來源:UCPrintMonitor.cs

示例6: sceNetResolverCreate

 public int sceNetResolverCreate(int *PointerToResolverId, void *Buffer, int BufferLength)
 {
     var Resolver = new Resolver();
     var ResolverId = Resolvers.Create(Resolver);
     *PointerToResolverId = ResolverId;
     //throw(new NotImplementedException());
     return 0;
 }
開發者ID:soywiz,項目名稱:cspspemu,代碼行數:8,代碼來源:sceNetResolver.cs

示例7: Create

        public static string Create(MethodReference mRef, Resolver resolver, ICode ast) {
            if (mRef.ContainsGenericParameters()) {
                throw new ArgumentException("Cannot create JS for method with open generic parameters");
            }
            var mDef = mRef.Resolve();
            if (mDef.IsAbstract) {
                throw new ArgumentException("Should never need to transcode an abstract method");
            }
            var tRef = mRef.DeclaringType;
            var tDef = tRef.Resolve();

            var v = new JsMethod(resolver);
            v.Visit(ast);
            var js = v.js.ToString();

            var sb = new StringBuilder();
            // Method declaration
            var methodName = resolver.MethodNames[mRef];
            //var parameterNames = mRef.Parameters.Select(x => v.parameters.ValueOrDefault(x).NullThru(y => resolver.LocalVarNames[y])).ToArray();
            // Match parameters, but have to do by position, as method built may be a custom method replacing a BCL method,
            // so parameters are not the same.
            var parameterNames = mRef.Parameters.Select(x => v.parameters.FirstOrDefault(y => y.Key.Sequence == x.Sequence).Value.NullThru(y => resolver.LocalVarNames[y])).ToArray();
            if (!mDef.IsStatic) {
                var thisName = v.vars.FirstOrDefault(x => x.ExprType == Expr.NodeType.VarThis).NullThru(x => resolver.LocalVarNames[x]);
                parameterNames = parameterNames.Prepend(thisName).ToArray();
            }
            var unusedParameterNameGen = new NameGenerator();
            parameterNames = parameterNames.Select(x => x ?? ("_" + unusedParameterNameGen.GetNewName())).ToArray();
            sb.AppendFormat("// {0}", mRef.FullName);
            sb.AppendLine();
            sb.AppendFormat("var {0} = function({1}) {{", methodName, string.Join(", ", parameterNames));
            // Variable declarations
            var declVars = v.vars
                .Select(x => new { name = resolver.LocalVarNames[x], type = x.Type })
                .Where(x => !parameterNames.Contains(x.name))
                .Select(x => {
                    var name = x.name;
                    if (x.type.IsValueType) {
                        name += " = " + DefaultValuer.Get(x.type, resolver.FieldNames);
                    }
                    return name;
                })
                .Distinct() // Bit of a hack, but works for now
                .ToArray();
            if (declVars.Any()) {
                sb.AppendLine();
                sb.Append(' ', tabSize);
                sb.AppendFormat("var {0};", string.Join(", ", declVars));
            }
            // Method body
            sb.AppendLine(js);
            // Method ending
            sb.AppendLine("};");

            var sbStr = sb.ToString();
            return sbStr;
        }
開發者ID:chrisdunelm,項目名稱:DotNetWebToolkit,代碼行數:57,代碼來源:JsMethod.cs

示例8: SDKEngine

 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="createdOnForeground"></param>
 public SDKEngine(bool createdOnForeground)
 {
     _appIsOnForeground = createdOnForeground;
     LayoutManager = LayoutManager.Instance;
     Resolver = new Resolver();
     _eventHistory = new EventHistory();
     _nextTimeToProcessDelayedActions = DateTimeOffset.MaxValue;
     UnresolvedActionCount = 0;
 }
開發者ID:WombatWorks,項目名稱:windows10-sdk,代碼行數:13,代碼來源:SDKEngine.cs

示例9: Main

 static void Main(string[] args)
 {
     var resolver = new Resolver();
     resolver.Register<Shopper, Shopper>();
     //resolver.Register<ICreditCard, MasterCard>();
     resolver.Register<ICreditCard, Visa>();
     var shopper = resolver.Resolve<Shopper>();
     shopper.Charge();
     Console.Read();
 }
開發者ID:zjlgdx,項目名稱:CSCodeCollection,代碼行數:10,代碼來源:Program.cs

示例10: TinyIocBasic

        public void TinyIocBasic()
        {
            var resolver = new Resolver();

            resolver.Container.Register<IJsonSerializer>(new JsonSerializer());
            //resolver.AddDynamic<IJsonSerializer>(() => new JsonSerializer());
            var serializer = resolver.GetService<IJsonSerializer>();

            Assert.IsNotNull(serializer);
        }
開發者ID:paul33868,項目名稱:SimplyMobile,代碼行數:10,代碼來源:IoCResolveTests.cs

示例11: TestMultipleConstructorsOfMaxSize

 public void TestMultipleConstructorsOfMaxSize()
 {
     Resolver r = new Resolver();
       Mock<IIocContainer> context = new Mock<IIocContainer>();
       try
       {
     r.ResolveDependency(typeof(MatchingConstructorCounts), context.Object);
     Assert.Fail();
       }
       catch (IocException) { }
 }
開發者ID:hanson-andrew,項目名稱:RockSolidIoc,代碼行數:11,代碼來源:ResolverTests.cs

示例12: TestMultipleIocConstructorAttributes

 public void TestMultipleIocConstructorAttributes()
 {
     Resolver r = new Resolver();
       Mock<IIocContainer> context = new Mock<IIocContainer>();
       try
       {
     r.ResolveDependency(typeof(BadConstructorAttributes), context.Object);
     Assert.Fail();
       }
       catch (IocException) { }
 }
開發者ID:hanson-andrew,項目名稱:RockSolidIoc,代碼行數:11,代碼來源:ResolverTests.cs

示例13: TestPropertyAndMethodSetup

 public void TestPropertyAndMethodSetup()
 {
     Resolver r = new Resolver();
       Mock<IIocContainer> context = new Mock<IIocContainer>();
       object returnedObject = new object();
       string returnedString = "returnedString";
       context.Setup((c) => c.Resolve(typeof(object), String.Empty)).Returns(returnedObject);
       context.Setup((c) => c.Resolve(typeof(string), String.Empty)).Returns(returnedString);
       PropertyAndMethodInitialization result = (r.ResolveDependency(typeof(PropertyAndMethodInitialization), context.Object) as PropertyAndMethodInitialization);
       Assert.AreEqual(returnedObject, result.O);
       Assert.AreEqual(returnedString, result.S);
 }
開發者ID:hanson-andrew,項目名稱:RockSolidIoc,代碼行數:12,代碼來源:ResolverTests.cs

示例14: TestIoc

        public void TestIoc()
        {
            Assert.DoesNotThrow(
                () =>
                    {
                        var r = new Resolver(new[] {"CH."});
                        var mf = r.Resolve<IMemcachedFactory>();
                        var mc = mf.Create(MemcachedSettings.Settings.Server("localhost", 17325));

                        mc.Stats();
                    });
        }
開發者ID:tanglebones,項目名稱:ch-memcached,代碼行數:12,代碼來源:TestFixture.cs

示例15: TestNoResolution

 public void TestNoResolution() {
    Resolver<ContentType> resolver = new Resolver<ContentType>();
    resolver.Add(new ContentType("*.html", "text/html"));
    resolver.Add(new ContentType("*.jpg", "image/jpeg"));
    resolver.Add(new ContentType("/images/*", "image/jpeg"));
    resolver.Add(new ContentType("/log/**", "text/plain"));
    resolver.Add(new ContentType("*.exe", "application/octetstream"));
    resolver.Add(new ContentType("**.txt", "text/plain"));
    resolver.Add(new ContentType("/html/*", "text/html"));
    AssertEquals(7, resolver.Count);
    AssertEquals("text/plain", resolver.Resolve("README.txt").Value);
    AssertEquals(null, resolver.Resolve("README"));
 }
開發者ID:ngallagher,項目名稱:simplexml,代碼行數:13,代碼來源:ResolverTest.cs


注:本文中的System.Resolver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。