Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void createKeys() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateKeys()
        {
            TokenWrite tokenWrite = TokenWriteInNewTransaction();

            this._labelId     = tokenWrite.LabelGetOrCreateForName("Person");
            this._propertyId1 = tokenWrite.PropertyKeyGetOrCreateForName("foo");
            this._propertyId2 = tokenWrite.PropertyKeyGetOrCreateForName("bar");
            Commit();
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void getOrCreateIds() throws org.neo4j.internal.kernel.api.exceptions.KernelException
        private void getOrCreateIds()
        {
            using (Transaction tx = _graphDb.beginTx())
            {
                ThreadToStatementContextBridge bridge = _graphDb.DependencyResolver.resolveDependency(typeof(ThreadToStatementContextBridge));

                TokenWrite tokenWrite = bridge.GetKernelTransactionBoundToThisThread(true).tokenWrite();
                _labelId          = tokenWrite.LabelGetOrCreateForName("Person");
                _relTypeId        = tokenWrite.RelationshipTypeGetOrCreateForName("Knows");
                _propertyKeyId    = tokenWrite.PropertyKeyGetOrCreateForName("name");
                _relPropertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName("duration");
                tx.Success();
            }
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void createLabelAndProperty() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateLabelAndProperty()
        {
            TokenWrite tokenWrites = TokenWriteInNewTransaction();

            _labelId        = tokenWrites.LabelGetOrCreateForName(LABEL);
            _labelId2       = tokenWrites.LabelGetOrCreateForName(LABEL2);
            _relType        = tokenWrites.RelationshipTypeGetOrCreateForName(REL_TYPE);
            _relType2       = tokenWrites.RelationshipTypeGetOrCreateForName(REL_TYPE2);
            _propertyKeyId  = tokenWrites.PropertyKeyGetOrCreateForName(PROPERTY_KEY);
            _propertyKeyId2 = tokenWrites.PropertyKeyGetOrCreateForName(PROPERTY_KEY2);
            _descriptor     = SchemaDescriptorFactory.forLabel(_labelId, _propertyKeyId);
            _descriptor2    = SchemaDescriptorFactory.forLabel(_labelId, _propertyKeyId2);
            Commit();
            _executorService = Executors.newCachedThreadPool();
        }
Пример #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeClass public static void initStorage() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public static void InitStorage()
        {
            using (Transaction transaction = Db.beginTx())
            {
                TokenWrite tokenWrite = Transaction.tokenWrite();
                tokenWrite.PropertyKeyGetOrCreateForName(PROP1);
                tokenWrite.PropertyKeyGetOrCreateForName(PROP2);
                tokenWrite.LabelGetOrCreateForName(LABEL1);
                tokenWrite.LabelGetOrCreateForName(LABEL2);
                tokenWrite.RelationshipTypeGetOrCreateForName(TYPE1);
                transaction.Success();
            }
            SchemaStore schemaStore = ResolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores().SchemaStore;

            _storage = new SchemaStorage(schemaStore);
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void createKeys() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateKeys()
        {
            TokenWrite tokenWrite = tokenWriteInNewTransaction();

            this.TypeId        = InitializeLabelOrRelType(tokenWrite, KEY);
            this.PropertyKeyId = tokenWrite.PropertyKeyGetOrCreateForName(PROP);
            this.Descriptor    = MakeDescriptor(TypeId, PropertyKeyId);
            commit();
        }