当前位置: 首页>>代码示例>>C#>>正文


C# Schema类代码示例

本文整理汇总了C#中Schema的典型用法代码示例。如果您正苦于以下问题:C# Schema类的具体用法?C# Schema怎么用?C# Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Schema类属于命名空间,在下文中一共展示了Schema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public object Execute(Schema schema, string query, object root = null,
            Inputs inputs = null, string operationName = "")
        {
            var source = new Source(query ?? "", "GraphQL Request");

            return string.Empty;
        }
开发者ID:thangchung,项目名称:graphql4net,代码行数:7,代码来源:GraphQL.cs

示例2: CategoriesQueryTests

        static CategoriesQueryTests()
        {
            repository = new Repository("CategoriesQueryTests");

            categorySchema = new Schema(repository, "category");
            categorySchema.AddColumn(new Column() { Name = "title", DataType = DataType.String, Length = 256 });

            categoryFolder = new TextFolder(repository, "category") { SchemaName = categorySchema.Name };

            newsSchema = new Schema(repository, "news");
            newsSchema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 256
            });
            newsSchema.AddColumn(new Column()
            {
                Name = "Comments",
                DataType = DataType.Int
            });

            newsFolder = new TextFolder(repository, "news") { SchemaName = newsSchema.Name, CategoryFolders = new[] { categoryFolder.Name } };

            ProviderFactory providerFactory = new ProviderFactory();
            Providers.DefaultProviderFactory = providerFactory;
            providerFactory.GetProvider<IRepositoryProvider>().Add(repository);
            providerFactory.GetProvider<ISchemaProvider>().Add(categorySchema);
            providerFactory.GetProvider<ISchemaProvider>().Add(newsSchema);
            providerFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);
            providerFactory.GetProvider<ITextFolderProvider>().Add(categoryFolder);
            InitializeData();
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:33,代码来源:CategoriesQueryTests.cs

示例3: OnTradeAddItem

        public override void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem)
        {
            // USELESS DEBUG MESSAGES -------------------------------------------------------------------------------
            SendTradeMessage("Object AppID: {0}", inventoryItem.AppId);
            SendTradeMessage("Object ContextId: {0}", inventoryItem.ContextId);

            switch (inventoryItem.AppId)
            {
                case 440:
                    SendTradeMessage("TF2 Item Added.");
                    SendTradeMessage("Name: {0}", schemaItem.Name);
                    SendTradeMessage("Quality: {0}", inventoryItem.Quality);
                    SendTradeMessage("Level: {0}", inventoryItem.Level);
                    SendTradeMessage("Craftable: {0}", (inventoryItem.IsNotCraftable ? "No" : "Yes"));
                    break;

                case 753:
                    GenericInventory.ItemDescription tmpDescription = OtherSteamInventory.getDescription(inventoryItem.Id);
                    SendTradeMessage("Steam Inventory Item Added.");
                    SendTradeMessage("Type: {0}", tmpDescription.type);
                    SendTradeMessage("Marketable: {0}", (tmpDescription.marketable ? "Yes" : "No"));
                    break;

                default:
                    SendTradeMessage("Unknown item");
                    break;
            }
            // ------------------------------------------------------------------------------------------------------
        }
开发者ID:Timboy67678,项目名称:SteamBot,代码行数:29,代码来源:SteamTradeDemoHandler.cs

示例4: SchemaTableDetail_HelperTable

        public SchemaTableDetail_HelperTable(Schema schema)
            : base(schema)
        {
            ID = StaticID;
            Name = "Конфигурация.Таблица.Деталь";

            SchemaTableColumn c;

            c = new SchemaTableColumn();
            c.Name = "ID";
            c.DataType = new GuidDataType() { Column = c };
            c.ColumnRoles.Add(RoleConst.Таблица_Ключ);
            c.IsNotNullable = true;
            c.Table = this;
            Columns.Add(c);

            c = new SchemaTableColumn();
            c.Name = "Имя";
            c.DataType = new StringDataType() { Column = c, MaxSize = 128 };
            c.IsNotNullable = false;
            c.Table = this;
            Columns.Add(c);

            c = new SchemaTableColumn();
            c.Name = "Таблица";
            c.DataType = new ForeingKeyDataType() { Column = c, RefTableID = SchemaTable_HelperTable.StaticID };
            c.IsNotNullable = false;
            c.Table = this;
            Columns.Add(c);
        }
开发者ID:KostiaSA,项目名称:Buhta5,代码行数:30,代码来源:SchemaTableDetail_HelperTable.cs

示例5: ImportDbml

        public Schema ImportDbml(Stream stream)
        {
            if(stream == null) 
                throw new ArgumentNullException("stream");

            var typeToTableMapping = new Dictionary<string, ITableDefinition>();

            var document = new XmlDocument();
            document.Load(stream);

            var schema = new Schema();

            foreach(XmlNode tableNode in document.SelectNodes("dbml:Database/dbml:Table", namespaceManager))
            {
                var name = tableNode.Attributes["Name"].Value.Split('.');

                ISchemaDefinition schemaDefinition = schema.GetSchema(name[0]);// new SchemaDefinition(name[0]);
                var tableDefinition = new TableDefinition(name[1], schemaDefinition);

                schema.AddSchema(schemaDefinition);
                //schemaDefinition.

                //Console.WriteLine(tableNode.Name);
            } // foreach

            return schema;
        }
开发者ID:hoonsbara,项目名称:octalforty-wizardby,代码行数:27,代码来源:DbmlImporter.cs

示例6: TextContentBinderTests

 public TextContentBinderTests()
 {
     schema = new Schema() { IsDummy = false };
     schema.AddColumn(new Column()
     {
         Name = "Title",
         DataType = DataType.String,
         ControlType = "TextBox",
         Validations = new ColumnValidation[] { new RequiredValidation() { ErrorMessage = "The field is requried" } }
     });
     schema.AddColumn(new Column()
         {
             Name = "Body",
             DataType = DataType.String,
             ControlType = "TextBox"
         });
     schema.AddColumn(new Column()
     {
         Name = "Comments",
         DataType = DataType.Int,
         ControlType = "TextBox"
     });
     schema.AddColumn(new Column()
     {
         Name = "PostDate",
         DataType = DataType.DateTime,
         ControlType = "TextBox"
     });
 }
开发者ID:Godoy,项目名称:CMS,代码行数:29,代码来源:TextContentBinderTests.cs

示例7: Bind

        public virtual TextContent Bind(Schema schema, TextContent textContent, System.Collections.Specialized.NameValueCollection values, bool update, bool thorwViolationException)
        {
            List<RuleViolation> violations = new List<RuleViolation>();
            schema = schema.AsActual();
            //do not to create a new content instance
            //it will interrupt the object state for ravendb.
            //textContent = new TextContent(textContent);

            foreach (Column column in ((ISchema)(schema.AsActual())).Columns.Where(it => !string.IsNullOrEmpty(it.ControlType)))
            {
                var value = values[column.Name];
                //IControl control = column.GetControlType();
                ////
                //if (control != null)
                //{
                //    value = control.GetValue(textContent[column.Name], value);
                //}
                // Update content will keep the old values;
                if (value == null && update == true)
                {
                    continue;
                }
                //postedData[column.Name] = value;

                ParseColumnValue(textContent, ref violations, column, value);

                ValidateColumn(schema, textContent, ref violations, column, update);
            }
            if (thorwViolationException && violations.Count > 0)
            {
                throw new RuleViolationException(textContent, violations);
            }
            return textContent;
        }
开发者ID:RameshGD,项目名称:CMS,代码行数:34,代码来源:TextContentBinder.cs

示例8: ShouldBuy

        public override bool ShouldBuy(Inventory.Item inventoryItem, Schema.Item schemaItem, out string reason)
        {
            int count = getNumItems(inventoryItem.Defindex, inventoryItem.Quality);

            foreach (ulong id in Trade.OtherOfferedItems)
            {
                Inventory.Item otherItem = Trade.OtherInventory.GetItem(id);
                if (otherItem.Defindex == inventoryItem.Defindex)
                {
                    count++;
                }
            }
            if (count >= 4)
            {
                reason = "I have too many of that item.";
                return false;
            }
            if (IsGifted(inventoryItem))
            {
                reason = "Item is gifted.";
                return false;
            }
            if (inventoryItem.Quality != "3")
            {
                reason = "Item is not vintage.";
                return false;
            }
            reason = null;
            return true;
        }
开发者ID:vcmiller,项目名称:SteamBot,代码行数:30,代码来源:VintageUserHandler.cs

示例9: GetContentByUrl

        /// <summary>
        /// Gets the raw string (xml) from the broker db by URL
        /// </summary>
        /// <param name="Url">URL of the page</param>
        /// <returns>String with page xml or empty string if no page was found</returns>
        public string GetContentByUrl(string Url)
        {
            Page page = new Page();
            page.Title = Randomizer.AnyString(15);
            page.Id = Randomizer.AnyUri(64);
            page.Filename = Randomizer.AnySafeString(8) + ".html";

            PageTemplate pt = new PageTemplate();
            pt.Title = Randomizer.AnyString(20);
            Field ptfieldView = new Field();
            ptfieldView.Name = "view";
            ptfieldView.Values.Add("Standard");
            pt.MetadataFields = new FieldSet();
            pt.MetadataFields.Add(ptfieldView.Name, ptfieldView);

            page.PageTemplate = pt;

            Schema schema = new Schema();
            schema.Title = Randomizer.AnyString(10);

            Component component = new Component();
            component.Title = Randomizer.AnyString(30);
            component.Id = Randomizer.AnyUri(16);
            component.Schema = schema;

            Field field1 = Randomizer.AnyTextField(6, 120, true);
            Field field2 = Randomizer.AnyTextField(8, 40, false);

            FieldSet fieldSet = new FieldSet();
            fieldSet.Add(field1.Name, field1);
            fieldSet.Add(field2.Name, field2);
            component.Fields = fieldSet;

            ComponentTemplate ct = new ComponentTemplate();
            ct.Title = Randomizer.AnyString(20);
            Field fieldView = new Field();
            fieldView.Name = "view";
            fieldView.Values.Add("DefaultComponentView");
            ct.MetadataFields = new FieldSet();
            ct.MetadataFields.Add(fieldView.Name, fieldView);

            ComponentPresentation cp = new ComponentPresentation();
            cp.Component = component;
            cp.ComponentTemplate = ct;

            page.ComponentPresentations = new List<ComponentPresentation>();
            page.ComponentPresentations.Add(cp);

            FieldSet metadataFields = new FieldSet();
            page.MetadataFields = metadataFields;

            var serializer = new XmlSerializer(typeof(Page));
            StringBuilder builder = new StringBuilder();
            StringWriter writer = new StringWriter(builder);
            //XmlTextWriter writer = new XmlTextWriter(page.Filename, Encoding.UTF8);
            //serializer.Serialize(writer, page);
            serializer.Serialize(writer, page);
            string pageAsString = builder.ToString();
            return pageAsString;
        }
开发者ID:flaithbheartaigh,项目名称:dynamic-delivery-4-tridion,代码行数:65,代码来源:TridionPageProvider.cs

示例10: SetReferences

        internal void SetReferences(Schema schema, BizTalkArtifacts artifacts, Microsoft.BizTalk.ExplorerOM.Schema omSchema)
        {
            schema.Application = artifacts.Applications[omSchema.Application.Id()];
            schema.ParentAssembly = artifacts.Assemblies[omSchema.BtsAssembly.Id()];

            if (_schema == null || _schema.Name == null || !_schema.Name.Equals(schema.Name, StringComparison.Ordinal))
            {
                var source = new XmlDocument();
                source.LoadXml(omSchema.GetXmlContent());

                var mgr = new XmlNamespaceManager(source.NameTable);
                mgr.AddNamespace("b", "http://schemas.microsoft.com/BizTalk/2003");
                mgr.AddNamespace("x", "http://www.w3.org/2001/XMLSchema");

                SetSchemaType(schema, source, mgr);
                SetSchemaImports(schema, source, mgr, artifacts);

                if (omSchema.Properties != null)
                {
                    foreach (DictionaryEntry property in omSchema.Properties)
                    {
                        schema.Properties.Add(new KeyValuePair<string, string>(property.Key.ToString(),
                                                                               property.Value.ToString()));
                    }
                }

                _schema = schema;
            }
            else
            {
                schema.Properties = _schema.Properties;
                schema.SchemaType = _schema.SchemaType;
                schema.ReferencedSchemas = _schema.ReferencedSchemas;
            }
        }
开发者ID:riha,项目名称:btswebdoc,代码行数:35,代码来源:SchemaModelTransformer.cs

示例11: CoreGetColumnParameters

        protected override IEnumerable<IDataParameter> CoreGetColumnParameters(IUnitOfWorkContext unitOfWorkContext, string dataSourceTag, Database database, Schema schema, Table table)
        {
            if ((object)unitOfWorkContext == null)
                throw new ArgumentNullException("unitOfWorkContext");

            if ((object)dataSourceTag == null)
                throw new ArgumentNullException("dataSourceTag");

            if ((object)database == null)
                throw new ArgumentNullException("database");

            if ((object)schema == null)
                throw new ArgumentNullException("schema");

            if ((object)table == null)
                throw new ArgumentNullException("table");

            if (dataSourceTag.SafeToString().ToLower() == "net.sqlserver" ||
                dataSourceTag.SafeToString().ToLower() == "net.sqlce")
            {
                return new IDataParameter[]
                       {
                           unitOfWorkContext.CreateParameter(ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@SchemaName", schema.SchemaName),
                           unitOfWorkContext.CreateParameter(ParameterDirection.Input, DbType.String, 100, 0, 0, true, "@TableOrViewName", table.TableName)
                       };
            }

            throw new ArgumentOutOfRangeException(string.Format("dataSourceTag: '{0}'", dataSourceTag));
        }
开发者ID:sami1971,项目名称:textmetal,代码行数:29,代码来源:SqlSchemaSourceStrategy.cs

示例12: OtherValue

        public override Price OtherValue(Inventory.Item inventoryItem, Schema.Item schemaItem)
        {
            Price value = Pricelist.Get(inventoryItem.Defindex, inventoryItem.Quality, false);
            //int highValue = ToScrap(Pricelist.getHighPrice(inventoryItem.Defindex, inventoryItem.Quality));

            if (value <= Pricelist.Scrap * 3)
                return value - Pricelist.Scrap * 1;
            if (value <= Pricelist.Scrap * 6)
                return value - Pricelist.Scrap * 2;
            if (value <= Pricelist.Refined * 2)
                return value - Pricelist.Scrap * 3;
            if (value <= Pricelist.Refined * 2.33)
                return Pricelist.Refined * 1.66;
            if (value <= Pricelist.Refined * 3.66)
                return value - Pricelist.Scrap * 6;
            if (value <= Pricelist.Refined * 4)
                return Pricelist.Refined * 3;
            if (value <= Pricelist.Refined * 5.33)
                return value - Pricelist.Refined * 1;
            if (value <= Pricelist.Refined * 5.66)
                return Pricelist.Refined * 4.33;
            if (value <= Pricelist.Refined * 6.33)
                return value - Pricelist.Refined * 1.33;
            else
                return Pricelist.Refined * 5;
        }
开发者ID:vcmiller,项目名称:SteamBot,代码行数:26,代码来源:StrangeUserHandler.cs

示例13: ExecuteAsync

        public async Task<ExecutionResult> ExecuteAsync(Schema schema, object root, string query, string operationName, Inputs inputs = null)
        {
            var document = _documentBuilder.Build(query);
            var result = new ExecutionResult();

            var validationResult = _documentValidator.IsValid(schema, document, operationName);

            if (validationResult.IsValid)
            {
                var context = BuildExecutionContext(schema, root, document, operationName, inputs);

                if (context.Errors.Any())
                {
                    result.Errors = context.Errors;
                    return result;
                }

                result.Data = await ExecuteOperation(context);
                result.Errors = context.Errors;
            }
            else
            {
                result.Data = null;
                result.Errors = validationResult.Errors;
            }

            return result;
        }
开发者ID:bryanerayner,项目名称:graphql-dotnet,代码行数:28,代码来源:DocumentExecuter.cs

示例14: Create

        public virtual ActionResult Create(Schema schema, bool? finish)
        {
            JsonResultEntry resultEntry = new JsonResultEntry(ModelState);
            try
            {
                if (ModelState.IsValid)
                {
                    Manager.Add(Repository, schema);

                    this.ResetAllForm(schema.Name);

                    if (finish.Value == true)
                    {
                        resultEntry.RedirectUrl = this.Url.Action("Index", Request.RequestContext.AllRouteValues().Merge("schemaName", schema.Name));
                    }
                    else
                    {
                        resultEntry.RedirectUrl = this.Url.Action("Templates", Request.RequestContext.AllRouteValues().Merge("schemaName", schema.Name));
                    }
                }

            }
            catch (Exception e)
            {
                resultEntry.AddException(e);
            }
            return Json(resultEntry);
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:28,代码来源:SchemaController.cs

示例15: DocumentValidatorTests

        public DocumentValidatorTests()
        {
            var testSchema = new Schema()
            {
                new Property { Name = "wrongType", Type = typeof(string) },
                new Property
                {
                    Name = "required",
                    Type = typeof(string),
                    Options = new ValidationOptions(required: true)
                },
                new Property
                {
                    Name = "unique",
                    Type = typeof(string),
                    Options = new ValidationOptions(unique: true)
                },
                new Property
                {
                    Name = "pattern",
                    Type = typeof(string),
                    Options = new ValidationOptions(pattern: "test")
                },
                new Property
                {
                    Name = "patternNotString",
                    Type = typeof(int),
                    Options = new ValidationOptions(pattern: "test")
                }
            };
            var mongoDatabaseMock = new Mocks.MongoDatabase("DATABASENAME");
            var collection = new Collection("COLLECTIONNAME", mongoDatabaseMock);

            DocumentValidator = new DocumentValidator(testSchema, collection);
        }
开发者ID:r0flbear,项目名称:MongoInterface,代码行数:35,代码来源:DocumentValidatorTests.cs


注:本文中的Schema类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。