//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: //ORIGINAL LINE: private String getOrCreateSchemaState(String key, final String maybeSetThisState) private string GetOrCreateSchemaState(string key, string maybeSetThisState) { using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = StatementContextSupplier.getKernelTransactionBoundToThisThread(true); string state = ktx.SchemaRead().schemaStateGetOrCreate(key, s => maybeSetThisState); tx.Success(); return(state); } }
private bool SchemaStateContains(string key) { using (Transaction tx = Db.beginTx()) { KernelTransaction ktx = StatementContextSupplier.getKernelTransactionBoundToThisThread(true); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean result = new java.util.concurrent.atomic.AtomicBoolean(true); AtomicBoolean result = new AtomicBoolean(true); ktx.SchemaRead().schemaStateGetOrCreate(key, s => { result.set(false); return(null); }); tx.Success(); return(result.get()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mixingBeansApiWithKernelAPI() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MixingBeansApiWithKernelAPI() { // 1: Start your transactions through the Beans API Transaction transaction = Db.beginTx(); // 2: Get a hold of a KernelAPI transaction this way: KernelTransaction ktx = StatementContextSupplier.getKernelTransactionBoundToThisThread(true); // 3: Now you can interact through both the statement context and the kernel API to manipulate the // same transaction. Node node = Db.createNode(); int labelId = ktx.TokenWrite().labelGetOrCreateForName("labello"); ktx.DataWrite().nodeAddLabel(node.Id, labelId); // 4: Commit through the beans API transaction.Success(); transaction.Close(); }