当前位置: 首页>>代码示例>>C#>>正文


C# Reference.Walk方法代码示例

本文整理汇总了C#中System.Reference.Walk方法的典型用法代码示例。如果您正苦于以下问题:C# Reference.Walk方法的具体用法?C# Reference.Walk怎么用?C# Reference.Walk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reference的用法示例。


在下文中一共展示了Reference.Walk方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SerializeBooleanField

        public void SerializeBooleanField()
        {
            var idAndBoolean = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("IsBaz", FieldType.Boolean)
            };
            var foobar = new OracularTable ("Foobar", null, null, idAndBoolean);
            var tables = new List<OracularTable>
            {
                foobar
            };
            var specs = new List<OracularSpec> ();
            var config = new OracularConfig (tables, specs);

            var foobarReference = new Reference (new [] { "Foobar", "IsBaz" });

            var sql = foobarReference.Walk (new Sqlizer (foobar, config));

            Assert.AreEqual ("[Foobar].[IsBaz] = 1", sql);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:21,代码来源:SqlizerTests.cs

示例2: ExpectReferenceRootToBeInTables

        public void ExpectReferenceRootToBeInTables()
        {
            var justAnId = new List<FieldConfig>
            {
                new FieldConfig("Id", null)
            };
            var tables = new List<OracularTable>
            {
                new OracularTable("Other", null, null, justAnId),
                new OracularTable("Tables", null, null, justAnId)
            };
            var config = new OracularConfig (tables, new List<OracularSpec> ());
            var checker = new RefChecker (config);

            var reference = new Reference (new []{ "Foobar" });

            var initial = new []{ "Other", "Tables" };

            var ex = Assert.Throws<RefCheckException> (() => reference.Walk (checker, initial));

            Assert.That (JOIN_RE.IsMatch (ex.Message));
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:22,代码来源:RefCheckerTests.cs

示例3: CheckReferenceRoot

        public void CheckReferenceRoot()
        {
            var justAnId = new List<FieldConfig>
            {
                new FieldConfig("Id", null)
            };
            var tables = new List<OracularTable>
            {
                new OracularTable("Foobar", null, null, justAnId)
            };
            var config = new OracularConfig (tables, new List<OracularSpec> ());
            var checker = new RefChecker (config);

            var reference = new Reference (new []{ "Foobar" });

            var initial = new []{ "Foobar" };

            var result = reference.Walk (checker, initial);

            Assert.AreEqual (1, result.Length);
            Assert.Contains ("Foobar", result);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:22,代码来源:RefCheckerTests.cs

示例4: SerializeFieldOnAlias

        public void SerializeFieldOnAlias()
        {
            var foobar = foobarTable ();
            var tables = new List<OracularTable>
            {
                foobar
            };
            var specs = new List<OracularSpec> ();
            var config = new OracularConfig (tables, specs);

            var foobarReference = new Reference (new [] { "Foobar", "Id" });

            var sql = foobarReference.Walk (new Sqlizer (foobar, config, "Alias"));

            Assert.AreEqual ("[Alias].[Id]", sql);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:16,代码来源:SqlizerTests.cs

示例5: SerializeTableName

        public void SerializeTableName()
        {
            var foobar = foobarTable ();
            var tables = new List<OracularTable>
            {
                foobar
            };
            var specs = new List<OracularSpec> ();
            var config = new OracularConfig (tables, specs);

            var foobarReference = new Reference (new [] { "Foobar" });

            var sql = foobarReference.Walk (new Sqlizer (foobar, config));

            Assert.AreEqual ("[Foobar]", sql);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:16,代码来源:SqlizerTests.cs

示例6: SerializeParentTable

        public void SerializeParentTable()
        {
            var justAnId = new List<FieldConfig>
            {
                new FieldConfig("Id", null)
            };
            var idAndBarId = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("BarId", null)
            };
            var barRelationship = new List<ParentConfig>
            {
                new ParentConfig("Bar", null, null)
            };
            var foo = new OracularTable ("Foo", null, barRelationship, idAndBarId);
            var tables = new List<OracularTable>
            {
                foo,
                new OracularTable("Bar", null, null, justAnId)
            };
            var specs = new List<OracularSpec> ();
            var config = new OracularConfig (tables, specs);

            var foobarReference = new Reference (new [] { "Foo", "Bar" });

            var builder = new Sqlizer (foo, config);
            var sql = foobarReference.Walk (builder);

            Assert.AreEqual ("[Foo.Bar]", sql);

            Assert.AreEqual (1, builder.JoinTables.Count ());
            var joinClause = builder.JoinTables.First();

            Assert.AreEqual ("INNER JOIN [Bar] [Foo.Bar] ON [Foo.Bar].[Id] = [Foo].[BarId]", joinClause);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:36,代码来源:SqlizerTests.cs

示例7: SerializeGrandparentTableOnAlias

        public void SerializeGrandparentTableOnAlias()
        {
            var justAnId = new List<FieldConfig>
            {
                new FieldConfig("Id", null)
            };
            var idAndBazId = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("BazId", null)
            };
            var bazRelationship = new List<ParentConfig>
            {
                new ParentConfig("Baz", null, null)
            };
            var idAndBarId = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("BarId", null)
            };
            var barRelationship = new List<ParentConfig>
            {
                new ParentConfig("Bar", null, null)
            };
            var foo = new OracularTable ("Foo", null, barRelationship, idAndBarId);
            var tables = new List<OracularTable>
            {
                foo,
                new OracularTable("Bar", null, bazRelationship, idAndBazId),
                new OracularTable("Baz", null, null, justAnId)
            };
            var specs = new List<OracularSpec> ();
            var config = new OracularConfig (tables, specs);

            var foobarReference = new Reference (new [] { "Foo", "Bar", "Baz" });

            var builder = new Sqlizer (foo, config, "Alias");
            var sql = foobarReference.Walk (builder);

            Assert.AreEqual ("[Alias.Bar.Baz]", sql);

            Assert.AreEqual (2, builder.JoinTables.Count ());
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:43,代码来源:SqlizerTests.cs

示例8: ReferenceTypesFromTable

        public void ReferenceTypesFromTable(FieldType fieldType, SpecType specType)
        {
            var fieldConfig = new List<FieldConfig>
            {
                new FieldConfig("Id", null),
                new FieldConfig("Test", fieldType)
            };
            var tables = new List<OracularTable>
            {
                new OracularTable ("Foobar", null, null, fieldConfig)
            };
            var config = new OracularConfig (tables, new List<OracularSpec> ());

            var reference = new Reference (new string[]{ "Foobar", "Test" });

            var refType = reference.Walk (new TypeChecker (config));

            Assert.AreEqual (specType, refType.Type);
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:19,代码来源:TypeCheckerTests.cs

示例9: ExpectTableToExist

        public void ExpectTableToExist()
        {
            var reference = new Reference (new string[]{ "Foobar", "Test" });

            var ex = Assert.Throws<TypeCheckException> (() => reference.Walk (new TypeChecker ()));

            Assert.That (ex.Message, Is.StringContaining ("name"));
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:8,代码来源:TypeCheckerTests.cs

示例10: ExpectParentToExist

        public void ExpectParentToExist()
        {
            var justAnId = new List<FieldConfig>
            {
                new FieldConfig("Id", null)
            };
            var tables = new List<OracularTable>
            {
                new OracularTable("Foobar", null, null, justAnId)
            };
            var config = new OracularConfig (tables, new List<OracularSpec> ());
            var reference = new Reference (new string[]{ "Foobar", "Parent", "Test" });

            var ex = Assert.Throws<TypeCheckException> (() => reference.Walk (new TypeChecker (config)));

            Assert.That (ex.Message, Is.StringContaining ("parent"));
        }
开发者ID:couchand,项目名称:oracular-dot-net,代码行数:17,代码来源:TypeCheckerTests.cs


注:本文中的System.Reference.Walk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。