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


C# DbPropertyValues.SetValues方法代码示例

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


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

示例1: Calling_SetValues_with_dictionary_of_derived_type_works

        public void Calling_SetValues_with_dictionary_of_derived_type_works()
        {
            var fromProperties = new Dictionary<string, object>
                                     {
                                         { "Id", 1 }
                                     };
            var fromValues = new DbPropertyValues(new TestInternalPropertyValues<FakeDerivedTypeWithProps>(fromProperties));

            var toProperties = new Dictionary<string, object>
                                   {
                                       { "Id", 0 }
                                   };
            var toValues = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(toProperties));

            toValues.SetValues(fromValues);

            Assert.Equal(1, toValues["Id"]);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:18,代码来源:DbPropertyValuesTests.cs

示例2: SetValues_when_nested_dictionary_is_for_wrong_type_throws

        public void SetValues_when_nested_dictionary_is_for_wrong_type_throws()
        {
            var fromProperties = new Dictionary<string, object>
                                     {
                                         { "Id", 1 }
                                     };
            var fromValues = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(fromProperties));

            var toProperties = new Dictionary<string, object>
                                   {
                                       { "Id", 0 }
                                   };
            var toValues = new DbPropertyValues(new TestInternalPropertyValues<FakeDerivedTypeWithProps>(toProperties));

            Assert.Equal(
                Strings.DbPropertyValues_AttemptToSetValuesFromWrongType(
                    typeof(FakeTypeWithProps).Name, typeof(FakeDerivedTypeWithProps).Name),
                Assert.Throws<ArgumentException>(() => toValues.SetValues(fromValues)).Message);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:19,代码来源:DbPropertyValuesTests.cs

示例3: Non_Generic_DbPropertyValues_SetValues_with_a_dictionary_works_on_the_underlying_dictionary

        public void Non_Generic_DbPropertyValues_SetValues_with_a_dictionary_works_on_the_underlying_dictionary()
        {
            var fromValues = new DbPropertyValues(CreateSimpleValues());
            fromValues["Id"] = 1;

            var toValues = new DbPropertyValues(CreateSimpleValues());

            toValues.SetValues(fromValues);

            Assert.Equal(1, toValues["Id"]);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:11,代码来源:DbPropertyValuesTests.cs

示例4: Attempt_to_copy_values_from_null_dictionary_on_non_generic_DbPropertyValues_throws

        public void Attempt_to_copy_values_from_null_dictionary_on_non_generic_DbPropertyValues_throws()
        {
            var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>());

            Assert.Equal("propertyValues", Assert.Throws<ArgumentNullException>(() => values.SetValues(null)).ParamName);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:6,代码来源:DbPropertyValuesTests.cs

示例5: Calling_SetValues_with_instance_of_derived_type_works

        public void Calling_SetValues_with_instance_of_derived_type_works()
        {
            var properties = new Dictionary<string, object>
                                 {
                                     { "Id", 0 }
                                 };
            var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(properties));

            values.SetValues(
                new FakeDerivedTypeWithProps
                    {
                        Id = 1
                    });

            Assert.Equal(1, values["Id"]);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:16,代码来源:DbPropertyValuesTests.cs

示例6: Non_Generic_DbPropertyValues_SetValues_works_on_the_underlying_dictionary

        public void Non_Generic_DbPropertyValues_SetValues_works_on_the_underlying_dictionary()
        {
            var properties = new Dictionary<string, object>
                                 {
                                     { "Id", 0 }
                                 };
            var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>(properties));

            values.SetValues(
                new FakeTypeWithProps
                    {
                        Id = 1
                    });

            Assert.Equal(1, values["Id"]);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:16,代码来源:DbPropertyValuesTests.cs

示例7: Attempt_to_copy_values_from_null_object_throws

        public void Attempt_to_copy_values_from_null_object_throws()
        {
            var values = new DbPropertyValues(new TestInternalPropertyValues<FakeTypeWithProps>());

            Assert.Equal("obj", Assert.Throws<ArgumentNullException>(() => values.SetValues((object)null)).ParamName);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:6,代码来源:DbPropertyValuesTests.cs


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