当前位置: 首页>>代码示例>>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;未经允许,请勿转载。