コード例 #1
0
        public void CtorODataModelAttribute_SetsModel()
        {
            // Assert & Act & Assert
            ODataModelAttribute odataModel = new ODataModelAttribute();

            Assert.Equal(string.Empty, odataModel.Model);

            // Assert & Act & Assert
            odataModel = new ODataModelAttribute("odata");
            Assert.Equal("odata", odataModel.Model);
        }
コード例 #2
0
        private static bool CanApply(string prefix, ControllerModel controller)
        {
            ODataModelAttribute odataModel = controller.GetAttribute <ODataModelAttribute>();

            if (odataModel == null)
            {
                return(true); // apply to all model
            }
            else if (prefix == odataModel.Model)
            {
                return(true);
            }

            return(false);
        }