コード例 #1
0
        public void Can_retrieve_properties()
        {
            var source = new EntityType("Source", "N", DataSpace.CSpace);
            var target = new EntityType("Target", "N", DataSpace.CSpace);
            var sourceEnd = new AssociationEndMember("SourceEnd", source);
            var targetEnd = new AssociationEndMember("TargetEnd", target);
            var associationType 
                = AssociationType.Create(
                    "AT",
                    "N",
                    true,
                    DataSpace.CSpace,
                    sourceEnd,
                    targetEnd,
                    null,
                    null);
            var sourceSet = new EntitySet("SourceSet", "S", "T", "Q", source);
            var targetSet = new EntitySet("TargetSet", "S", "T", "Q", target);
            var associationSet
                = AssociationSet.Create(
                    "AS",
                    associationType,
                    sourceSet,
                    targetSet,
                    null);

            var members = new List<EdmMember> { null, targetEnd };
            var memberPath = new ModificationFunctionMemberPath(members, associationSet);

            Assert.Equal(members, memberPath.Members);
            Assert.Equal(targetEnd.Name, memberPath.AssociationSetEnd.Name);
        }
コード例 #2
0
        public void Can_retrieve_properties()
        {
            var source    = new EntityType("Source", "N", DataSpace.CSpace);
            var target    = new EntityType("Target", "N", DataSpace.CSpace);
            var sourceEnd = new AssociationEndMember("SourceEnd", source);
            var targetEnd = new AssociationEndMember("TargetEnd", target);
            var associationType
                = AssociationType.Create(
                      "AT",
                      "N",
                      true,
                      DataSpace.CSpace,
                      sourceEnd,
                      targetEnd,
                      null,
                      null);
            var sourceSet = new EntitySet("SourceSet", "S", "T", "Q", source);
            var targetSet = new EntitySet("TargetSet", "S", "T", "Q", target);
            var associationSet
                = AssociationSet.Create(
                      "AS",
                      associationType,
                      sourceSet,
                      targetSet,
                      null);

            var members = new List <EdmMember> {
                null, targetEnd
            };
            var memberPath = new ModificationFunctionMemberPath(members, associationSet);

            Assert.Equal(members, memberPath.Members);
            Assert.Equal(targetEnd.Name, memberPath.AssociationSetEnd.Name);
        }
コード例 #3
0
        public void SetReadOnly_is_called_on_child_mapping_items()
        {
            var parameter        = new FunctionParameter();
            var memberPath       = new ModificationFunctionMemberPath(Enumerable.Empty <EdmMember>(), null);
            var parameterBinding = new ModificationFunctionParameterBinding(parameter, memberPath, true);

            Assert.False(memberPath.IsReadOnly);
            parameterBinding.SetReadOnly();
            Assert.True(memberPath.IsReadOnly);
        }
コード例 #4
0
        public void Can_retrieve_properties()
        {
            var parameter        = new FunctionParameter();
            var memberPath       = new ModificationFunctionMemberPath(Enumerable.Empty <EdmMember>(), null);
            var parameterBinding = new ModificationFunctionParameterBinding(parameter, memberPath, true);

            Assert.Same(parameter, parameterBinding.Parameter);
            Assert.Same(memberPath, parameterBinding.MemberPath);
            Assert.Equal(true, parameterBinding.IsCurrent);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new ModificationFunctionParameterBinding instance.
        /// </summary>
        /// <param name="parameter">The parameter taking the value.</param>
        /// <param name="memberPath">The path to the entity or association member defining the value.</param>
        /// <param name="isCurrent">A flag indicating whether the current or original member value is being bound.</param>
        public ModificationFunctionParameterBinding(
            FunctionParameter parameter, ModificationFunctionMemberPath memberPath, bool isCurrent)
        {
            Check.NotNull(parameter, "parameter");
            Check.NotNull(memberPath, "memberPath");

            _parameter  = parameter;
            _memberPath = memberPath;
            _isCurrent  = isCurrent;
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new ModificationFunctionParameterBinding instance.
        /// </summary>
        /// <param name="parameter">The parameter taking the value.</param>
        /// <param name="memberPath">The path to the entity or association member defining the value.</param>
        /// <param name="isCurrent">A flag indicating whether the current or original member value is being bound.</param>
        public ModificationFunctionParameterBinding(
            FunctionParameter parameter, ModificationFunctionMemberPath memberPath, bool isCurrent)
        {
            Check.NotNull(parameter, "parameter");
            Check.NotNull(memberPath, "memberPath");

            _parameter = parameter;
            _memberPath = memberPath;
            _isCurrent = isCurrent;
        }
        public void SetReadOnly_is_called_on_child_mapping_items()
        {
            var parameter = new FunctionParameter();
            var memberPath = new ModificationFunctionMemberPath(Enumerable.Empty<EdmMember>(), null);
            var parameterBinding = new ModificationFunctionParameterBinding(parameter, memberPath, true);

            Assert.False(memberPath.IsReadOnly);
            parameterBinding.SetReadOnly();
            Assert.True(memberPath.IsReadOnly);
        }
        public void Can_retrieve_properties()
        {
            var parameter = new FunctionParameter();
            var memberPath = new ModificationFunctionMemberPath(Enumerable.Empty<EdmMember>(), null);
            var parameterBinding = new ModificationFunctionParameterBinding(parameter, memberPath, true);

            Assert.Same(parameter, parameterBinding.Parameter);
            Assert.Same(memberPath, parameterBinding.MemberPath);
            Assert.Equal(true, parameterBinding.IsCurrent);
        }
コード例 #9
0
 /// <summary>
 /// Initializes a new ModificationFunctionParameterBinding instance.
 /// </summary>
 /// <param name="parameter">The parameter taking the value.</param>
 /// <param name="memberPath">The path to the entity or association member defining the value.</param>
 /// <param name="isCurrent">A flag indicating whether the current or original member value is being bound.</param>
 public ModificationFunctionParameterBinding(
     FunctionParameter parameter,
     ModificationFunctionMemberPath memberPath,
     bool isCurrent)
 {
     Check.NotNull <FunctionParameter>(parameter, nameof(parameter));
     Check.NotNull <ModificationFunctionMemberPath>(memberPath, nameof(memberPath));
     this._parameter  = parameter;
     this._memberPath = memberPath;
     this._isCurrent  = isCurrent;
 }
コード例 #10
0
        public void Cannot_create_with_null_argument()
        {
            var parameter  = new FunctionParameter();
            var memberPath = new ModificationFunctionMemberPath(Enumerable.Empty <EdmMember>(), null);

            Assert.Equal(
                "parameter",
                Assert.Throws <ArgumentNullException>(
                    () => new ModificationFunctionParameterBinding(
                        null, memberPath, false)).ParamName);

            Assert.Equal(
                "memberPath",
                Assert.Throws <ArgumentNullException>(
                    () => new ModificationFunctionParameterBinding(
                        parameter, null, false)).ParamName);
        }
        public void Cannot_create_with_null_argument()
        {
            var parameter = new FunctionParameter();
            var memberPath = new ModificationFunctionMemberPath(Enumerable.Empty<EdmMember>(), null);

            Assert.Equal(
                "parameter",
                Assert.Throws<ArgumentNullException>(
                    () => new ModificationFunctionParameterBinding(
                        null, memberPath, false)).ParamName);

            Assert.Equal(
                "memberPath",
                Assert.Throws<ArgumentNullException>(
                    () => new ModificationFunctionParameterBinding(
                        parameter, null, false)).ParamName);
        }
        public void Can_generate_ia_fk_parameters()
        {
            var functionParameterMappingGenerator
                = new FunctionParameterMappingGenerator(ProviderRegistry.Sql2008_ProviderManifest);

            var associationType
                = new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)
                      {
                          SourceEnd = new AssociationEndMember("S", new EntityType("E", "N", DataSpace.CSpace)),
                          TargetEnd = new AssociationEndMember("T", new EntityType("E", "N", DataSpace.CSpace))
                      };

            var associationSet
                = new AssociationSet("AS", associationType)
                      {
                          SourceSet = new EntitySet(),
                          TargetSet = new EntitySet()
                      };

            var memberPath
                = new ModificationFunctionMemberPath(
                    new EdmMember[] { new EdmProperty("P"), associationType.TargetEnd },
                    associationSet);

            var parameterBindings
                = functionParameterMappingGenerator
                    .Generate(
                        new[] { Tuple.Create(memberPath, new EdmProperty("param")) },
                        useOriginalValues: true)
                    .ToList();

            var parameterBinding = parameterBindings.Single();

            Assert.Equal("param", parameterBinding.Parameter.Name);
            Assert.Same(memberPath, parameterBinding.MemberPath);
            Assert.Equal("String", parameterBinding.Parameter.TypeName);
            Assert.Equal(ParameterMode.In, parameterBinding.Parameter.Mode);
            Assert.False(parameterBinding.IsCurrent);
        }