コード例 #1
0
        private Func <ApiMutableSchema, ApiMutableScalarType> CreateApiMutableScalarTypeFactory(Type clrScalarType)
        {
            Contract.Requires(clrScalarType != null);

            ApiMutableScalarType ApiMutableScalarTypeFactory(ApiMutableSchema apiMutableSchema)
            {
                Contract.Requires(apiMutableSchema != null);

                // Apply conventions
                this.ApiPrecedenceStack.Push(ApiPrecedenceLevel.Convention);

                var apiConventionSet      = apiMutableSchema?.ApiConventionSet;
                var apiConventionSettings = apiMutableSchema?.ApiConventionSettings;

                this.ApplyApiScalarTypeNameConventions(clrScalarType, apiConventionSet, apiConventionSettings);

                this.ApiPrecedenceStack.Pop();

                // Create API scalar type context
                var apiDefaultName        = clrScalarType.Name;
                var apiDefaultDescription = clrScalarType.CreateDefaultApiScalarTypeDescription();
                var apiMutableScalarType  = new ApiMutableScalarType
                {
                    ApiMutableSchema = apiMutableSchema,
                    ApiName          = apiDefaultName,
                    ApiDescription   = apiDefaultDescription,
                    ClrScalarType    = clrScalarType
                };

                return(apiMutableScalarType);
            }

            return(ApiMutableScalarTypeFactory);
        }
コード例 #2
0
        private static IApiScalarType CreateApiScalarType(ApiMutableScalarType apiMutableScalarType)
        {
            Contract.Requires(apiMutableScalarType != null);

            var apiName        = apiMutableScalarType.ApiName;
            var apiDescription = apiMutableScalarType.ApiDescription;
            var clrScalarType  = apiMutableScalarType.ClrScalarType;
            var apiScalarType  = ApiTypeFactory.CreateApiScalarType(apiName, apiDescription, clrScalarType);

            return(apiScalarType);
        }