Пример #1
0
        public void ComponentEventTests()
        {
            var entityContainer = new EntityContainer();
            var System          = new TestGameSystem(entityContainer);

            var Entity1 = Entity.CreateNew();

            Entity1.Add(new TestComponent());
            Entity1.Add(new TestChildComponent());

            entityContainer.Add(Entity1);

            Assert.True(System.componentsAdded == 2 && System.componentsRemoved == 0);

            var Entity2 = Entity.CreateNew();

            entityContainer.Add(Entity2);
            Entity2.Add(new TestComponent());

            Assert.True(System.componentsAdded == 3 && System.componentsRemoved == 0);

            Entity2.Remove <TestComponent>();

            Assert.True(System.componentsAdded == 3 && System.componentsRemoved == 1);

            entityContainer.Remove(Entity1);

            Assert.True(System.componentsAdded == 3 && System.componentsRemoved == 3);
        }
Пример #2
0
        private void CloneContainerContents(EntityContainer baseContainer, EntityContainer extendedContainer)
        {
            foreach (var entitySet in baseContainer.EntitySets)
            {
                var clonedEntitySet = new EntitySet(entitySet.Name, entitySet.EntityType);
                extendedContainer.Add(clonedEntitySet);
            }

            foreach (var associationSet in baseContainer.AssociationSets)
            {
                var clonedAssociationSet = new AssociationSet(associationSet.Name, associationSet.AssociationType);
                foreach (var setEnd in associationSet.Ends)
                {
                    clonedAssociationSet.Add(new AssociationSetEnd(setEnd.AssociationEnd, setEnd.EntitySet.Name));
                }

                extendedContainer.Add(clonedAssociationSet);
            }

            foreach (var functionImport in baseContainer.FunctionImports)
            {
                var clonedFunctionImport = new FunctionImport(functionImport.Name);
                foreach (var returnType in functionImport.ReturnTypes)
                {
                    clonedFunctionImport.ReturnTypes.Add(returnType);
                }

                foreach (var parameter in functionImport.Parameters)
                {
                    clonedFunctionImport.Add(new FunctionParameter(parameter.Name, parameter.DataType, parameter.Mode));
                }

                extendedContainer.Add(clonedFunctionImport);
            }
        }
        private EntityContainer ConvertToTaupoEntityContainer(IEdmEntityContainer edmEntityContainer)
        {
            var taupoEntityContainer = new EntityContainer(edmEntityContainer.Name);

            foreach (var edmEntitySet in edmEntityContainer.Elements.OfType <IEdmEntitySet>())
            {
                EntitySet taupoEntitySet = this.ConvertToTaupoEntitySet(edmEntitySet);
                taupoEntityContainer.Add(taupoEntitySet);

                foreach (var edmNavigationProperty in edmEntitySet.NavigationPropertyBindings.Select(t => t.NavigationProperty))
                {
                    if (!this.associationRegistry.IsAssociationSetRegistered(edmEntitySet, edmNavigationProperty))
                    {
                        this.associationRegistry.RegisterAssociationSet(edmEntitySet, edmNavigationProperty);
                    }
                }
            }

            foreach (var edmFunctionImport in edmEntityContainer.Elements.OfType <IEdmOperationImport>())
            {
                FunctionImport taupoFunctionImport = this.ConvertToTaupoFunctionImport(edmFunctionImport);
                taupoEntityContainer.Add(taupoFunctionImport);
            }

            this.ConvertAnnotationsIntoTaupo(edmEntityContainer, taupoEntityContainer);
            return(taupoEntityContainer);
        }
        public bool AddTest([PexAssumeUnderTest] EntityContainer target, Entity e)
        {
            bool result = target.Add(e);

            return(result);
            // TODO: add assertions to method EntityContainerTest.AddTest(EntityContainer, Entity)
        }
Пример #5
0
        /// <summary>
        /// Parses an entity container element in the csdl/ssdl file.
        /// </summary>
        /// <param name="entityContainerElement">the entity container element to parse</param>
        /// <returns>the parsed entity container object in the entity model schema</returns>
        protected virtual EntityContainer ParseEntityContainer(XElement entityContainerElement)
        {
            string name            = entityContainerElement.GetRequiredAttributeValue("Name");
            var    entityContainer = new EntityContainer(name);

            foreach (var entitySetElement in entityContainerElement.Elements().Where(el => this.IsXsdlElement(el, "EntitySet")))
            {
                entityContainer.Add(this.ParseEntitySet(entitySetElement));
            }

            foreach (var entitySetElement in entityContainerElement.Elements().Where(el => this.IsXsdlElement(el, "AssociationSet")))
            {
                entityContainer.Add(this.ParseAssociationSet(entitySetElement));
            }

            this.ParseAnnotations(entityContainer, entityContainerElement);
            return(entityContainer);
        }
Пример #6
0
        /// <summary>
        /// Creates a new function import with the specified name.
        /// </summary>
        /// <param name="container">The <see cref="EntityContainer"/> to create the function import in.</param>
        /// <param name="localName">The name for the function import to create.</param>
        /// <returns>The newly created function import instance.</returns>
        public static FunctionImport FunctionImport(this EntityContainer container, string localName)
        {
            ExceptionUtilities.CheckArgumentNotNull(container, "container");
            ExceptionUtilities.CheckStringArgumentIsNotNullOrEmpty(localName, "localName");

            FunctionImport functionImport = new FunctionImport(localName);

            container.Add(functionImport);
            return(functionImport);
        }
Пример #7
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (ValidateEntry())
     {
         ec.Add(new Entity(txtName.Text, initHold, hpHold,
                           acHold, strHold, dexHold,
                           conHold, intHold, wisHold, chaHold));
         ClearTexts();
         combatantCount++;
         lblCombInd.Text = $"{selector + 1}/{combatantCount}";
     }
 }
Пример #8
0
        public void AddRemoveEntityEventTriggerTests()
        {
            int entitiyCount    = 0;
            var EntityContainer = new EntityContainer();

            EntityContainer.EntityAdded   += (sender, e) => { entitiyCount++; };
            EntityContainer.EntityRemoved += (sender, e) => { entitiyCount--; };

            Entity entity = Entity.CreateNew();

            EntityContainer.Add(entity);
            Assert.True(entitiyCount == 1);
            EntityContainer.Remove(entity);
            Assert.True(entitiyCount == 0);
        }
Пример #9
0
        public EntityModelSchema GenerateModel()
        {
            this.useDataTypes = new Dictionary <DataType, bool>();

            var model = new EntityModelSchema()
            {
                new EntityType("Movie")
                {
                    Annotations =
                    {
                        new HasStreamAnnotation(),
                    },
                    Properties =
                    {
                        new MemberProperty("Id",               EdmDataTypes.Int32)
                        {
                            IsPrimaryKey = true
                        },
                        new MemberProperty("Name",             EdmDataTypes.String()),
                        new MemberProperty("LengthInMinutes",  EdmDataTypes.Int32)
                        {
                            Annotations = { new ConcurrencyTokenAnnotation() }
                        },
                        new MemberProperty("ReleaseYear",      EdmDataTypes.DateTime()),
                        new MemberProperty("Trailer",          EdmDataTypes.Stream),
                        new MemberProperty("FullMovie",        EdmDataTypes.Stream),
                        new MemberProperty("IsAwardWinner",    EdmDataTypes.Boolean),
                        new MemberProperty("AddToQueueValue",  EdmDataTypes.Boolean),
                        new MemberProperty("AddToQueueValue2", EdmDataTypes.Boolean),
                        new MemberProperty("MovieHomePage",    EdmDataTypes.String()).WithDataGenerationHints(DataGenerationHints.NoNulls,DataGenerationHints.AnsiString,  DataGenerationHints.MinLength(10)),
                        new MemberProperty("Description",      EdmDataTypes.String()).WithDataGenerationHints(DataGenerationHints.NoNulls,DataGenerationHints.AnsiString,  DataGenerationHints.MinLength(10)),
                    },

                    NavigationProperties =
                    {
                        new NavigationProperty("MovieRatings", "MovieRating_Movie", "Movie",  "MovieRating"),
                        new NavigationProperty("Actors",       "Movies_Actors",     "Movies", "Actors"),
                    }
                },
                new ComplexType("Phone")
                {
                    new MemberProperty("PhoneNumber", EdmDataTypes.String()),
                    new MemberProperty("Extension", EdmDataTypes.String().Nullable(true)),
                },
                new ComplexType("ContactDetails")
                {
                    new MemberProperty("PhoneMultiValue", DataTypes.CollectionOfComplex("Phone")),
                },
                new ComplexType("Rating")
                {
                    new MemberProperty("Comments", EdmDataTypes.String()),
                    new MemberProperty("FiveStarRating", EdmDataTypes.Byte),
                    new MemberProperty("Tags", DataTypes.CollectionType.WithElementDataType(DataTypes.String)),
                },
                new ComplexType("AllSpatialTypesComplex")
                {
                    new MemberProperty("Geog", EdmDataTypes.Geography.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogPoint", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogLine", EdmDataTypes.GeographyLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogPolygon", EdmDataTypes.GeographyPolygon.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogCollection", EdmDataTypes.GeographyCollection.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiPoint", EdmDataTypes.GeographyMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiLine", EdmDataTypes.GeographyMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiPolygon", EdmDataTypes.GeographyMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),

                    new MemberProperty("Geom", EdmDataTypes.Geometry.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomPoint", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomLine", EdmDataTypes.GeometryLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomPolygon", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomCollection", EdmDataTypes.GeometryCollection.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiPoint", EdmDataTypes.GeometryMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiLine", EdmDataTypes.GeometryMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiPolygon", EdmDataTypes.GeometryMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
                },
                new EntityType("MovieRating")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("Rating", DataTypes.ComplexType.WithDefinition("Rating")),
                    new MemberProperty("IsCreatedByCustomer", EdmDataTypes.Boolean),
                    new NavigationProperty("Movie", "MovieRating_Movie", "MovieRating", "Movie"),
                },
                new EntityType("Actor")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("FirstName", EdmDataTypes.String()),
                    new MemberProperty("LastName", EdmDataTypes.String()),
                    new MemberProperty("Age", EdmDataTypes.Int32),
                    new MemberProperty("IsAwardWinner", EdmDataTypes.Boolean),
                    new MemberProperty("ContactDetails", DataTypes.ComplexType.WithName("ContactDetails")),
                    new MemberProperty("PrimaryPhoneNumber", DataTypes.ComplexType.WithName("Phone")),
                    new MemberProperty("AdditionalPhoneNumbers", DataTypes.CollectionOfComplex("Phone")),
                    new MemberProperty("AlternativeNames", DataTypes.CollectionType.WithElementDataType(DataTypes.String)),
                    new NavigationProperty("Movies", "Movies_Actors", "Actors", "Movies"),
                },
                new EntityType("Producer")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("FirstName", EdmDataTypes.String()),
                    new MemberProperty("LastName", EdmDataTypes.String()),
                    new MemberProperty("Toggle", EdmDataTypes.Boolean),
                },
                new EntityType("ExecutiveProducer")
                {
                    BaseType = "Producer"
                },
                new EntityType("ActorMovieRating")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("IsStar", EdmDataTypes.Boolean),
                    new MemberProperty("Rating", DataTypes.ComplexType.WithDefinition("Rating")),
                    new NavigationProperty("Actor", "ActorMovieRating_Actor", "ActorMovieRating", "Actor"),
                    new NavigationProperty("Movie", "ActorMovieRating_Movie", "ActorMovieRating", "Movie"),
                },
                new EntityType("AllTypes")
                {
                    // This EntityType contains only primitive properties
                    new MemberProperty("Id", DataTypes.Integer)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("ToggleProperty", EdmDataTypes.Boolean),
                    new MemberProperty("BooleanProperty", EdmDataTypes.Boolean),
                    new MemberProperty("StringProperty", EdmDataTypes.String()).WithDataGenerationHints(DataGenerationHints.NoNulls),
                    new MemberProperty("ByteProperty", EdmDataTypes.Byte),
                    new MemberProperty("DateTimeProperty", EdmDataTypes.DateTime()),
                    new MemberProperty("DecimalProperty", EdmDataTypes.Decimal()),
                    new MemberProperty("DoubleProperty", EdmDataTypes.Double),
                    new MemberProperty("GuidProperty", EdmDataTypes.Guid),
                    new MemberProperty("Int16Property", EdmDataTypes.Int16),
                    new MemberProperty("Int32Property", EdmDataTypes.Int32),
                    new MemberProperty("Int64Property", EdmDataTypes.Int64),
                    new MemberProperty("SingleProperty", EdmDataTypes.Single),
                    new MemberProperty("BinaryProperty", EdmDataTypes.Binary()),
                    new MemberProperty("DateTimeOffsetProperty", EdmDataTypes.DateTimeOffset().NotNullable()),
                    new MemberProperty("TimeSpanProperty", EdmDataTypes.Time().NotNullable()),
                    new MemberProperty("NullableDateTimeOffsetProperty", EdmDataTypes.DateTimeOffset().Nullable()),
                    new MemberProperty("NullableTimeSpanProperty", EdmDataTypes.Time().Nullable()),

                    new MemberProperty("ByteCollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Byte)).WithDataGenerationHints(DataGenerationHints.NoNulls, DataGenerationHints.MaxCount(0)),
                    new MemberProperty("DoubleCollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Double)).WithDataGenerationHints(DataGenerationHints.NoNulls),
                    new MemberProperty("Int32CollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Int32)).WithDataGenerationHints(DataGenerationHints.NoNulls),
                    new MemberProperty("StringCollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.String())).WithDataGenerationHints(DataGenerationHints.NoNulls),
                    new MemberProperty("DateTimeOffsetCollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.DateTimeOffset())).WithDataGenerationHints(DataGenerationHints.NoNulls),
                    new MemberProperty("TimeSpanCollectionProperty", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Time())).WithDataGenerationHints(DataGenerationHints.NoNulls),

                    //// TODO: add the following
                    ////new MemberProperty("NullStringProperty", DataTypes.String).WithDataGenerationHints(DataGenerationHints.AllNulls),
                    ////new MemberProperty("NullBinaryProperty", DataTypes.Binary.WithMaxLength(500)).WithDataGenerationHints(DataGenerationHints.AllNulls),
                },
                new EntityType("AllSpatialTypes")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("ToggleProperty", EdmDataTypes.Boolean),
                    new MemberProperty("Int32Property", EdmDataTypes.Int32),

                    new MemberProperty("Geog", EdmDataTypes.Geography.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogPoint", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogLine", EdmDataTypes.GeographyLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogPolygon", EdmDataTypes.GeographyPolygon.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogCollection", EdmDataTypes.GeographyCollection.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiPoint", EdmDataTypes.GeographyMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiLine", EdmDataTypes.GeographyMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeogMultiPolygon", EdmDataTypes.GeographyMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),

                    new MemberProperty("Geom", EdmDataTypes.Geometry.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomPoint", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomLine", EdmDataTypes.GeometryLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomPolygon", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomCollection", EdmDataTypes.GeometryCollection.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiPoint", EdmDataTypes.GeometryMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiLine", EdmDataTypes.GeometryMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
                    new MemberProperty("GeomMultiPolygon", EdmDataTypes.GeometryMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),

                    new MemberProperty("Complex", DataTypes.ComplexType.WithName("AllSpatialTypesComplex")),
                },
                new EntityType("DVDCustomer")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("Name", EdmDataTypes.String()),
                    new MemberProperty("EMail", EdmDataTypes.String()),
                    new MemberProperty("Visa", EdmDataTypes.Int32),
                    new MemberProperty("BalancePaid", EdmDataTypes.Boolean),
                    new NavigationProperty("DVDShipActivities", "DVDCustomer_DVDShipActivities", "DVDCustomer", "DVDShipActivity"),
                },
                new EntityType("DVDShipActivity")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                    new MemberProperty("OrderDescription", EdmDataTypes.String()),
                    new MemberProperty("Title", EdmDataTypes.String()),
                    new MemberProperty("ShipTime", EdmDataTypes.DateTime()),
                    new MemberProperty("ReturnTime", EdmDataTypes.DateTime()),
                    new MemberProperty("ProblemReport", EdmDataTypes.String()),
                    new NavigationProperty("DVDCustomer", "DVDCustomer_DVDShipActivities", "DVDShipActivity", "DVDCustomer"),
                },
                new AssociationType("DVDCustomer_DVDShipActivities")
                {
                    new AssociationEnd("DVDCustomer", "DVDCustomer", EndMultiplicity.One),
                    new AssociationEnd("DVDShipActivity", "DVDShipActivity", EndMultiplicity.Many),
                },
                new AssociationType("Movies_Actors")
                {
                    new AssociationEnd("Movies", "Movie", EndMultiplicity.Many),
                    new AssociationEnd("Actors", "Actor", EndMultiplicity.Many),
                },
                new AssociationType("ActorMovieRating_Movie")
                {
                    new AssociationEnd("Movie", "Movie", EndMultiplicity.ZeroOne),
                    new AssociationEnd("ActorMovieRating", "ActorMovieRating", EndMultiplicity.Many),
                },
                new AssociationType("ActorMovieRating_Actor")
                {
                    new AssociationEnd("Actor", "Actor", EndMultiplicity.ZeroOne),
                    new AssociationEnd("ActorMovieRating", "ActorMovieRating", EndMultiplicity.Many),
                },
                new AssociationType("MovieRating_Movie")
                {
                    new AssociationEnd("MovieRating", "MovieRating", EndMultiplicity.Many),
                    new AssociationEnd("Movie", "Movie", EndMultiplicity.ZeroOne),
                },
                new Function("CheckoutFirstMovie")
                {
                    new ToggleBoolPropertyValueActionAnnotation()
                    {
                        SourceEntitySet = "Movie", ToggleProperty = "IsAwardWinner"
                    },
                    new ServiceOperationAnnotation()
                    {
                        BindingKind = OperationParameterBindingKind.Never, IsAction = true
                    }
                },
                new Function("PayCustomerBalance")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "BalancePaid", ReturnProperty = "DVDShipActivities"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction      = true,
                            EntitySetPath = "customer/DVDShipActivities",
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("customer", DataTypes.EntityType.WithDefinition("DVDCustomer")),
                    },

                    ReturnType = DataTypes.CollectionOfEntities("DVDShipActivity"),
                },
                new Function("AddToQueue")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "AddToQueueValue", ReturnProperty = "Id"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction = true,
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("movie", DataTypes.EntityType.WithDefinition("Movie")),
                    },

                    ReturnType = EdmDataTypes.Int32
                },
                new Function("UpVoteExecutiveProducer")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "Toggle", ReturnProperty = "FirstName"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction    = true,
                            BindingKind = OperationParameterBindingKind.Sometimes
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("executiveProducer", DataTypes.EntityType.WithDefinition("ExecutiveProducer")),
                    },

                    ReturnType = EdmDataTypes.String()
                },
                new Function("UpVoteProducer")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "Toggle", ReturnProperty = "FirstName"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction    = true,
                            BindingKind = OperationParameterBindingKind.Sometimes
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("producer", DataTypes.EntityType.WithDefinition("Producer")),
                    },

                    ReturnType = EdmDataTypes.String()
                },
                new Function("AddToQueue2")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "AddToQueueValue2", ReturnProperty = "Id"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction    = true,
                            BindingKind = OperationParameterBindingKind.Sometimes
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("movie", DataTypes.EntityType.WithDefinition("Movie")),
                    },

                    ReturnType = EdmDataTypes.Int32
                },
                new Function("AddToQueueThrowError")
                {
                    Annotations =
                    {
                        new ThrowDataServiceExceptionAnnotation()
                        {
                            ErrorStatusCode = 500, ErrorMessage = "Throwing error in AddToQueueThrowError function"
                        },
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "AddToQueueValue", ReturnProperty = "Id"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction = true,
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("movie", DataTypes.EntityType.WithDefinition("Movie")),
                    },

                    ReturnType = EdmDataTypes.Int32
                },

                new Function("MultiParameterFunction")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "AddToQueueValue", ReturnProperty = "Id"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction = true,
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("movie",    DataTypes.EntityType.WithDefinition("Movie")),
                        new FunctionParameter("author",   EdmDataTypes.String()),
                        new FunctionParameter("comments", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.String())),
                    },

                    ReturnType = EdmDataTypes.Int32
                },
                //// Declaring an action in the Actor Entity that will have a name collision with the 'Age' property
                new Function("Age")
                {
                    Annotations =
                    {
                        new ToggleBoolPropertyValueActionAnnotation()
                        {
                            ToggleProperty = "IsAwardWinner", ReturnProperty = "FirstName"
                        },
                        new ServiceOperationAnnotation()
                        {
                            IsAction = true,
                        }
                    },

                    Parameters =
                    {
                        new FunctionParameter("actor", DataTypes.EntityType.WithDefinition("Actor")),
                    },

                    ReturnType = EdmDataTypes.String()
                }
            };

            this.AddServiceOperationsToModel(model);

            new ResolveReferencesFixup().Fixup(model);
            new ApplyDefaultNamespaceFixup("NetflixActions").Fixup(model);
            new AddDefaultContainerFixup().Fixup(model);

            // add MEST scenarios in the model
            if (this.DataProviderSettings.SupportsMest)
            {
                EntityContainer ec = model.EntityContainers.Single();
                EntityType      customerEntityType            = ec.EntitySets.Single(es => es.Name == "DVDCustomer").EntityType;
                EntitySet       instantWatchCustomerEntitySet = new EntitySet("InstantWatchCustomer", customerEntityType);
                ec.Add(instantWatchCustomerEntitySet);

                EntityType activityEntityType            = ec.EntitySets.Single(es => es.Name == "DVDShipActivity").EntityType;
                EntitySet  instantWatchActivityEntitySet = new EntitySet("InstantWatchActivity", activityEntityType);
                ec.Add(instantWatchActivityEntitySet);

                AssociationType at = model.Associations.Single(a => a.Name == "DVDCustomer_DVDShipActivities");
                ec.Add(new AssociationSet("InstantWatchCustomer_InstantWatchActivities", at)
                {
                    Ends =
                    {
                        new AssociationSetEnd(at.Ends[0], instantWatchCustomerEntitySet),
                        new AssociationSetEnd(at.Ends[1], instantWatchActivityEntitySet),
                    }
                });
            }

            // Only add these actions if its not using the model for call order tests
            if (!this.AdaptModelForCallOrderTests)
            {
                this.AddEntityTypeDrivenToggleActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "ActorMovieRating"));
                this.AddEntityTypeDrivenToggleActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "Movie"));
                this.AddEntityTypeDrivenToggleActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "Actor"));
                this.AddEntityTypeDrivenToggleActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "AllTypes"));

                if (this.DataProviderSettings.SupportsSpatial)
                {
                    this.AddEntityTypeDrivenToggleActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "AllSpatialTypes"));
                }

                this.AddIncrementIntegerPropertyActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "AllTypes"), "Int32Property");

                if (this.DataProviderSettings.SupportsSpatial)
                {
                    this.AddIncrementIntegerPropertyActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "AllSpatialTypes"), "Int32Property");
                }

                this.AddIncrementIntegerPropertyActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "Actor"), "Age");
                this.AddIncrementIntegerPropertyActions(model, model.EntityContainers.First().EntitySets.Single(es => es.Name == "Movie"), "LengthInMinutes");
            }

            // Add page size = 1 for all exposed entity sets in the model
            var movieEntitySet = model.EntityContainers.First().EntitySets.Single(es => es.Name == "Movie");

            movieEntitySet.Annotations.Add(new PageSizeAnnotation()
            {
                PageSize = 1
            });

            this.SetupBindingParameterCollectionTypeAnnotation(model);

            if (this.RemoveHigherVersionModelFeaturesExceptActionWithMultiValue)
            {
                new AddDefaultContainerFixup().Fixup(model);
                new SetDefaultDataServiceConfigurationBehaviors()
                {
                    MaxProtocolVersion = DataServiceProtocolVersion.V4
                }.Fixup(model);

                var functionsToSave = model.Functions.Where(f => f.IsAction() && f.ReturnType != null && f.Parameters.Count > 0);
                var functionToSave  = functionsToSave.Where(f => f.Parameters.Any(p => p.DataType is CollectionDataType && !(((CollectionDataType)p.DataType).ElementDataType is EntityDataType))).ToArray().FirstOrDefault();
                new RemoveHigherVersionFeaturesFixup(DataServiceProtocolVersion.V4).Fixup(model);

                model.Add(functionToSave);
            }

            // Remove streams from the model if this is being used for call order tests
            if (this.AdaptModelForCallOrderTests)
            {
                new RemoveNamedStreamsFixup().Fixup(model);
                model.EntityTypes.ForEach(et => et.Annotations.RemoveAll(a => a.GetType() == typeof(HasStreamAnnotation)));

                // Add Query Interceptors for all sets so they will be triggered when running via call order
                model.EntityContainers.Single().EntitySets.ForEach(es => es.Annotations.Add(new ConstantInterceptorAnnotation()
                {
                    FilterConstant = true
                }));
            }

            return(model);
        }