public void SetupTests() { _graphClient = new GraphClient(new Uri("http://localhost:7474/db/data")); _graphClient.Connect(); _repository = new EntityRepository(_graphClient); }
public Neo4jRestTransaction(ITransactionalGraphClient graphClient, string database) { Endpoint = null; IsOpen = true; client = graphClient; Database = database; }
internal static Neo4jTransaction FromIdAndClient(int transactionId, ITransactionalGraphClient client) { return new Neo4jTransaction(client) { Endpoint = client.TransactionEndpoint.AddPath(transactionId.ToString()) }; }
public void SimpleTransaction_RetrieveAndSerializeAnonymousResult() { ISession session; IDriver driver; Neo4j.Driver.V1.ITransaction transaction; IGraphClient graphClient; GetAndConnectGraphClient(out graphClient, out driver, out session, out transaction); ITransactionalGraphClient txGc = (ITransactionalGraphClient)graphClient; using (var tx = txGc.BeginTransaction()) { var node = txGc.Cypher.Match("(n:Node)").Return(n => new { Node = n.As <MockNode>() }).Results.SingleOrDefault(); node.Node.Name.Should().Be("Value"); tx.Commit(); } driver.Received(1).Session(); session.Received(1).BeginTransaction(); transaction.Received(1).Success(); }
public GraphStore(IGraphClient graphClient, bool isUnitOfWorkConfigured) { _graphClient = graphClient; _transactionalGraphClient = (ITransactionalGraphClient)_graphClient; _isUnitOfWorkConfigured = isUnitOfWorkConfigured; _hasChanged = false; }
internal static Neo4jRestTransaction FromIdAndClient(int transactionId, ITransactionalGraphClient client) { return(new Neo4jRestTransaction(client) { Endpoint = client.TransactionEndpoint.AddPath(transactionId.ToString()) }); }
public static Task RegisterStepExecutorIndexes(this ITransactionalGraphClient graphClient) { if (graphClient == null) { throw new ArgumentNullException(nameof(graphClient)); } return(Task.WhenAll( graphClient.CreateIndex <LastTransaction, Guid>(arg => arg.IdempotentKey), graphClient.CreateIndex <LastTransaction, DateTime>(arg => arg.Created) )); }
public static Task CreateIndex <T, TU>(this ITransactionalGraphClient graphClient, Expression <Func <T, TU> > selector) { if (graphClient == null) { throw new ArgumentNullException(nameof(graphClient)); } if (selector == null) { throw new ArgumentNullException(nameof(selector)); } return(CreateIndexFromProps <T>(graphClient, selector.GetPropertyInfo().Name)); }
public TransactionManager(ITransactionalGraphClient client) { _client = client; // specifies that we are about to use variables that depend on OS threads Thread.BeginThreadAffinity(); _scopedTransactions = new Stack<TransactionScopeProxy>(); // this object enables the interacion with System.Transactions and MSDTC, at first by // letting us manage the transaction objects ourselves, and if we require to be promoted to MSDTC, // then it notifies the library how to do it. _promotable = new TransactionPromotableSinglePhaseNotification(client); _dtcContexts = new Dictionary<string, TransactionContext>(); }
public TransactionManager(ITransactionalGraphClient client) { _client = client; // specifies that we are about to use variables that depend on OS threads Thread.BeginThreadAffinity(); _scopedTransactions = new Stack <TransactionScopeProxy>(); // this object enables the interacion with System.Transactions and MSDTC, at first by // letting us manage the transaction objects ourselves, and if we require to be promoted to MSDTC, // then it notifies the library how to do it. _promotable = new TransactionPromotableSinglePhaseNotification(client); _dtcContexts = new Dictionary <string, TransactionContext>(); }
public AdminSQLPanel() { InitializeComponent(); dataBase = new DataBaseManager(); string connectionString = "mongodb://192.168.99.100:27017"; mongoclient = new MongoClient(connectionString); _client = new GraphClient(new Uri("http://192.168.99.100.:7474/db/data"), "neo4j", "password"); _client.Connect(); elasticClient = new ElasticClient(new ConnectionSettings(new Uri("http://192.168.99.100:9200")).DefaultIndex("filmdesc")); LoadCountryList(); LoadSubscriptionList(); LoadPeopleList(); LoadFilmList(); }
public void Init(string url, string user, string password) { // Create graph client Client = new GraphClient(new Uri(url), user, password); Client.Connect(); // Check if empty, if so, start setup process var query = Client.Cypher.Match("(n)") .Return(n => n.As <object>()) .Limit(1); if (query.Results.Count() == 0) { Setup(); } }
public async Task RegisterFTIndexes(ITransactionalGraphClient graphClient, CancellationToken cancellationToken) { if (graphClient == null) { throw new ArgumentNullException(nameof(graphClient)); } try { await CreateIndexes(graphClient, cancellationToken); } catch (NeoException e) when(e.NeoMessage.StartsWith("There already exists an index")) { // nothing to do } }
private void _confirmPayment_Click(object sender, EventArgs e) { _client = new GraphClient(new Uri("http://192.168.99.100.:7474/db/data"), "neo4j", "password"); _client.Connect(); User newUser = new User { id = Convert.ToInt32(userId) }; _client.Cypher .Merge("(user:User { id: {id} })") .OnCreate() .Set("user = {newUser}") .WithParams(new { id = newUser.id, newUser }) .ExecuteWithoutResults(); Film newFilm = new Film { _id = filmId }; _client.Cypher.Merge("(film:Film { _id: {_id} })") .OnCreate() .Set("film = {newFilm}") .WithParams(new { newFilm._id, newFilm }) .ExecuteWithoutResults(); var newDate = DateTime.Now.ToString("yyyy-MM-dd"); _client.Cypher .Match("(user:User)", "(film:Film)") .Where((User user) => user.id == newUser.id) .AndWhere((Film film) => film._id == filmId) .CreateUnique("(user)-[:BUY {date : {newDate}}]->(film)") .WithParams(new { newDate }) .ExecuteWithoutResults(); MessageBox.Show("Поздравляем с покупкой"); _client.Dispose(); Close(); }
protected static async Task SafeCreateIndex(ITransactionalGraphClient graphClient, Func <ICypherFluentQuery, ICypherFluentQuery> query, CancellationToken cancellationToken) { if (graphClient == null) { throw new ArgumentNullException(nameof(graphClient)); } if (query == null) { throw new ArgumentNullException(nameof(query)); } try { await query(graphClient.Cypher).ExecuteWithoutResultsAsync(); } catch (NeoException e) when(e.NeoMessage.StartsWith("There already exists an index")) { // nothing to do } }
public void SimpleTransaction_AsTransactionalGc_1Query() { ISession session; IDriver driver; Neo4j.Driver.V1.ITransaction transaction; IGraphClient graphClient; GetAndConnectGraphClient(out graphClient, out driver, out session, out transaction); ITransactionalGraphClient txGc = (ITransactionalGraphClient)graphClient; using (var tx = txGc.BeginTransaction()) { txGc.Cypher.Match("(n)").Set("n.Value = 'test'").ExecuteWithoutResults(); tx.Commit(); } driver.Received(1).Session(); session.Received(1).BeginTransaction(); transaction.Received(1).Success(); }
public static Task CreateIndex <T, TU, TU1>(this ITransactionalGraphClient graphClient, Expression <Func <T, TU> > selector, Expression <Func <T, TU1> > selector2) { if (graphClient == null) { throw new ArgumentNullException(nameof(graphClient)); } if (selector == null) { throw new ArgumentNullException(nameof(selector)); } if (selector2 == null) { throw new ArgumentNullException(nameof(selector2)); } var propList = new[] { selector.GetPropertyInfo().Name, selector2.GetPropertyInfo().Name }; return(CreateIndexFromProps <T>(graphClient, propList)); }
public Neo4jTransactionProxy(ITransactionalGraphClient client, TransactionContext transactionContext, bool newScope) : base(client, transactionContext) { _doCommitInScope = newScope; }
public BoltSuppressTransactionProxy(ITransactionalGraphClient client) : base(client, null) { }
protected TransactionScopeProxy(ITransactionalGraphClient client, TransactionContext transactionContext) { _client = client; _disposing = false; _transactionContext = transactionContext; }
public TransactionPromotableSinglePhaseNotification(ITransactionalGraphClient client) { _client = client; //_resourceManager = new Neo4jTransactionResourceManager(); }
public Neo4JOutboxDataProvider(ITransactionalGraphClient graphClient, IOptions <OutboxOptions> outboxOptions) { _graphClient = graphClient; _outboxOptions = outboxOptions.Value; }
public SuppressTransactionProxy(ITransactionalGraphClient client) : base(client, null) { }
public Neo4jRestTransaction(ITransactionalGraphClient graphClient) { Endpoint = null; IsOpen = true; client = graphClient; }
protected BoltTransactionScopeProxy(ITransactionalGraphClient client, BoltTransactionContext transactionContext) { this.client = client; disposing = false; this.transactionContext = transactionContext; }
protected abstract Task CreateIndexes(ITransactionalGraphClient graphClient, CancellationToken cancellationToken);
public EntityRepository(ITransactionalGraphClient graphClient) { _graphClient = graphClient; }
public Neo4jTransaction(ITransactionalGraphClient graphClient) { Endpoint = null; IsOpen = true; _client = graphClient; }
public OutboxDataProviderNeo4j(ITransactionalGraphClient graphClient, IOptions <OutboxOptions> outboxOptions) { _graphClient = graphClient ?? throw new ArgumentNullException(nameof(graphClient)); _outboxOptions = outboxOptions?.Value ?? throw new ArgumentNullException(nameof(outboxOptions)); }
public BoltTransactionPromotableSinglePhasesNotification(ITransactionalGraphClient client) { this.client = client; }
public OnceExecutorNeo4j(ITransactionalGraphClient graphClient) { Context = graphClient ?? throw new ArgumentNullException(nameof(graphClient)); }