コード例 #1
0
ファイル: ConstraintRule.cs プロジェクト: Neo4Net/Neo4Net
 internal ConstraintRule(long id, ConstraintDescriptor descriptor, long?ownedIndex, string name)
 {
     this._id         = id;
     this._descriptor = descriptor;
     this._ownedIndex = ownedIndex;
     this._name       = SchemaRule.nameOrDefault(name, "constraint_" + id);
 }
コード例 #2
0
 private ConstraintRule AssertConstraintRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is ConstraintRule))
     {
         fail("Expected ConstraintRule, but got " + schemaRule.GetType().Name);
     }
     return(( ConstraintRule )schemaRule);
 }
コード例 #3
0
 private StoreIndexDescriptor AssertIndexRule(SchemaRule schemaRule)
 {
     if (!(schemaRule is StoreIndexDescriptor))
     {
         fail("Expected IndexRule, but got " + schemaRule.GetType().Name);
     }
     return(( StoreIndexDescriptor )schemaRule);
 }
コード例 #4
0
        // PUBLIC

        /// <summary>
        /// Serialize the provided SchemaRule onto the target buffer
        /// </summary>
        /// <param name="schemaRule"> the SchemaRule to serialize </param>
        public static sbyte[] Serialize(SchemaRule schemaRule)
        {
            if (schemaRule is StoreIndexDescriptor)
            {
                return(Serialize(( StoreIndexDescriptor )schemaRule));
            }
            else if (schemaRule is ConstraintRule)
            {
                return(Serialize(( ConstraintRule )schemaRule));
            }
            throw new System.InvalidOperationException("Unknown schema rule type: " + schemaRule.GetType());
        }
コード例 #5
0
        private SchemaRecord Serialize(SchemaRule rule, long id, bool inUse, bool created)
        {
            DynamicRecord record = new DynamicRecord(id);

            record.Data = SchemaRuleSerialization.serialize(rule);
            if (created)
            {
                record.SetCreated();
            }
            if (inUse)
            {
                record.InUse = true;
            }
            return(new SchemaRecord(singletonList(record)));
        }
コード例 #6
0
 public override void AddSchemaRule(SchemaRule rule)
 {
     _schemaCache.addSchemaRule(rule);
 }