예제 #1
0
        /// <summary>
        /// Adds specific class with all referenced classes to the model.
        /// </summary>
        /// <param name="type">The type to add to the model.</param>
        /// <returns>Instance of the TypeScriptFluent that enables fluent configuration.</returns>
        public TypeScriptFluentModuleMember For(Type type)
        {
            var model = _modelBuilder.Add(type);

            if (model is TsClass || model is TsEnum)
            {
                return(new TypeScriptFluentModuleMember(this, model));
            }
            throw new InvalidOperationException("The type must be a class or an enum");
        }
예제 #2
0
        /// <summary>
        /// Adds specific class with all referenced classes to the model.
        /// </summary>
        /// <param name="type">The type to add to the model.</param>
        /// <returns>Instance of the TypeScriptFluent that enables fluent configuration.</returns>
        public TypeScriptFluentModuleMember For(Type type)
        {
            var typeConvertors = _scriptGenerator._typeConvertors._convertors;

            var model = _modelBuilder.Add(type, true, typeConvertors);

            if (model is TsClass || model is TsEnum)
            {
                return(new TypeScriptFluentModuleMember(this, model));
            }
            throw new InvalidOperationException("The type must be a class or an enum");
        }