├── .editorconfig ├── .github └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── Core.Arango.Tests ├── AnalyzerViewTest.cs ├── BackupTest.cs ├── CamelCaseTest.cs ├── CollectionTest.cs ├── Core.Arango.Tests.csproj ├── Core │ ├── CamelCaseData.cs │ ├── Entity.cs │ ├── PascalCaseData.cs │ └── TestBase.cs ├── DatabaseTest.cs ├── DependencyInjectionTest.cs ├── DocumentTest.cs ├── FoxxTest.cs ├── FunctionTest.cs ├── GraphTest.cs ├── IndexTest.cs ├── LinqTest.cs ├── LinqTest_BasicOperations.cs ├── LinqTest_DateTime.cs ├── LinqTest_String.cs ├── QueryFormattingTest.cs ├── QueryStatisticTest.cs ├── QueryTest.cs ├── Serializer.cs └── TransactionTest.cs ├── Core.Arango.sln ├── Core.Arango.sln.DotSettings ├── Core.Arango ├── ArangoConfiguration.cs ├── ArangoContext.cs ├── ArangoDB.png ├── ArangoDependencyInjectionExtension.cs ├── ArangoErrorCode.cs ├── ArangoException.cs ├── ArangoHandle.cs ├── ArangoIgnoreAttribute.cs ├── ArangoList.cs ├── Core.Arango.csproj ├── Core.Arango.xml ├── IArangoConfiguration.cs ├── IArangoContext.cs ├── Linq │ ├── Aql.Array.cs │ ├── Aql.Date.cs │ ├── Aql.Geo.cs │ ├── Aql.Misc.cs │ ├── Aql.Numeric.cs │ ├── Aql.String.cs │ ├── Aql.Type.cs │ ├── Aql.cs │ ├── ArangoContextExtension.cs │ ├── ArangoQueryExtensions.cs │ ├── ArangoShortestPathExtensions.cs │ ├── ArangoTraversalExtensions.cs │ ├── Attributes │ │ ├── AqlFunctionAttribute.cs │ │ └── CollectionPropertyAttribute.cs │ ├── Collection │ │ └── EdgeDirection.cs │ ├── Data │ │ ├── BaseResult.cs │ │ ├── EdgeVertexResult.cs │ │ ├── QueryData.cs │ │ ├── ShortestPathData.cs │ │ ├── TraversalData.cs │ │ ├── TraversalEdgeDefinition.cs │ │ ├── TraversalPathData.cs │ │ └── TraversalResult.cs │ ├── Interface │ │ ├── IAqlModifiable.cs │ │ ├── IArangoLinq.cs │ │ ├── ICollectionPropertySetting.cs │ │ ├── IDocumentPropertySetting.cs │ │ ├── IShortestPathQueryable.cs │ │ └── ITraversalQueryable.cs │ ├── Internal │ │ └── ArangoLinq.cs │ ├── Query │ │ ├── AqlParser.cs │ │ ├── ArangoExpressionTreeVisitor.cs │ │ ├── ArangoExpressionTreeVisitorLookups.cs │ │ ├── ArangoModelVisitor.cs │ │ ├── ArangoQueryExecuter.cs │ │ ├── ArangoQueryProvider.cs │ │ ├── ArangoQueryable.cs │ │ ├── Clause │ │ │ ├── FilterClause.cs │ │ │ ├── FilterExpressionNode.cs │ │ │ ├── GroupByClause.cs │ │ │ ├── GroupByExpressionNode.cs │ │ │ ├── IModificationClause.cs │ │ │ ├── ITraversalClause.cs │ │ │ ├── IgnoreModificationSelectExpressionNode.cs │ │ │ ├── InModificationExpressionNode.cs │ │ │ ├── InsertClause.cs │ │ │ ├── InsertExpressionNode.cs │ │ │ ├── LetClause.cs │ │ │ ├── LetLambdaExpressionNode.cs │ │ │ ├── LetSelectExpressionNode.cs │ │ │ ├── OptionsClause.cs │ │ │ ├── OptionsExpressionNode.cs │ │ │ ├── PartialUpdateClause.cs │ │ │ ├── PartialUpdateExpressionNode.cs │ │ │ ├── RemoveClause.cs │ │ │ ├── RemoveExpressionNode.cs │ │ │ ├── SelectExpressionNode.cs │ │ │ ├── SelectModificationClause.cs │ │ │ ├── SelectModificationExpressionNode.cs │ │ │ ├── ShortestPathExpressionNode.cs │ │ │ ├── SkipExpressionNode.cs │ │ │ ├── SkipTakeClause.cs │ │ │ ├── TakeExpressionNode.cs │ │ │ ├── TraversalClause.cs │ │ │ ├── TraversalDepthExpressionNode.cs │ │ │ ├── TraversalDirectionExpressionNode.cs │ │ │ ├── TraversalEdgeExpressionNode.cs │ │ │ ├── TraversalExpressionNode.cs │ │ │ ├── TraversalGraphNameExpressionNode.cs │ │ │ ├── TraversalOptionsExpressionNode.cs │ │ │ ├── UpdateReplaceClause.cs │ │ │ ├── UpdateReplaceExpressionNode.cs │ │ │ ├── UpsertClause.cs │ │ │ └── UpsertExpressionNode.cs │ │ ├── ExpressionParameterRewriter.cs │ │ ├── ExtentionIdentifierAttribute.cs │ │ ├── Grouping.cs │ │ ├── LinqUtility.cs │ │ ├── NamedExpression.cs │ │ └── SupportedMethodSpecifications.cs │ └── Utility │ │ ├── ReflectionUtils.cs │ │ └── Utils.cs ├── Modules │ ├── IArangoAnalyzerModule.cs │ ├── IArangoBackupModule.cs │ ├── IArangoCollectionModule.cs │ ├── IArangoDatabaseModule.cs │ ├── IArangoDocumentModule.cs │ ├── IArangoFoxxModule.cs │ ├── IArangoFunctionModule.cs │ ├── IArangoGraphEdgeModule.cs │ ├── IArangoGraphModule.cs │ ├── IArangoGraphVertexModule.cs │ ├── IArangoIndexModule.cs │ ├── IArangoPregelModule.cs │ ├── IArangoQueryModule.cs │ ├── IArangoTransactionModule.cs │ ├── IArangoUserModule.cs │ ├── IArangoViewModule.cs │ └── Internal │ │ ├── ArangoAnalyzerModule.cs │ │ ├── ArangoBackupModule.cs │ │ ├── ArangoCollectionModule.cs │ │ ├── ArangoDatabaseModule.cs │ │ ├── ArangoDocumentModule.cs │ │ ├── ArangoFoxxModule.cs │ │ ├── ArangoFunctionModule.cs │ │ ├── ArangoGraphEdgeModule.cs │ │ ├── ArangoGraphModule.cs │ │ ├── ArangoGraphVertexModule.cs │ │ ├── ArangoIndexModule.cs │ │ ├── ArangoModule.cs │ │ ├── ArangoPregelModule.cs │ │ ├── ArangoQueryModule.cs │ │ ├── ArangoTransactionModule.cs │ │ ├── ArangoUserModule.cs │ │ └── ArangoViewModule.cs ├── PolyfillHelper.cs ├── Protocol │ ├── ArangoAccess.cs │ ├── ArangoAnalyzer.cs │ ├── ArangoAnalyzerBreakType.cs │ ├── ArangoAnalyzerCase.cs │ ├── ArangoAnalyzerGeoJsonType.cs │ ├── ArangoAnalyzerProperties.cs │ ├── ArangoAnalyzerType.cs │ ├── ArangoAstNode.cs │ ├── ArangoBackup.cs │ ├── ArangoBackupRequest.cs │ ├── ArangoCollection.cs │ ├── ArangoCollectionType.cs │ ├── ArangoCollectionUpdate.cs │ ├── ArangoComputeOn.cs │ ├── ArangoComputedValue.cs │ ├── ArangoCursor.cs │ ├── ArangoDatabase.cs │ ├── ArangoDatabaseInfo.cs │ ├── ArangoDatabaseOptions.cs │ ├── ArangoEdgeDefinition.cs │ ├── ArangoEdgeNgram.cs │ ├── ArangoEdgeResponse.cs │ ├── ArangoError.cs │ ├── ArangoExplainResult.cs │ ├── ArangoFoxxService.cs │ ├── ArangoFoxxSource.cs │ ├── ArangoFunctionDefinition.cs │ ├── ArangoGraph.cs │ ├── ArangoGraphOptions.cs │ ├── ArangoIndex.cs │ ├── ArangoIndexType.cs │ ├── ArangoKeyOptions.cs │ ├── ArangoKeyType.cs │ ├── ArangoLinkProperty.cs │ ├── ArangoNgramStreamType.cs │ ├── ArangoOverwriteMode.cs │ ├── ArangoParseResult.cs │ ├── ArangoPregel.cs │ ├── ArangoPregelState.cs │ ├── ArangoQueryOptimizer.cs │ ├── ArangoQueryOptions.cs │ ├── ArangoQueryStatistic.cs │ ├── ArangoResponseBase.cs │ ├── ArangoSchema.cs │ ├── ArangoSchemaLevel.cs │ ├── ArangoSort.cs │ ├── ArangoTransaction.cs │ ├── ArangoTransactionScope.cs │ ├── ArangoUpdateResult.cs │ ├── ArangoUser.cs │ ├── ArangoVersion.cs │ ├── ArangoVertexCollection.cs │ ├── ArangoVertexResponse.cs │ ├── ArangoView.cs │ ├── ArangoViewCompressionType.cs │ ├── ArangoViewConsolidationPolicy.cs │ ├── ArangoViewConsolidationType.cs │ ├── ArangoViewInformation.cs │ ├── ArangoViewStoredValue.cs │ ├── ArangoVoid.cs │ └── Internal │ │ ├── BackupList.cs │ │ ├── DocumentCreateResponse.cs │ │ ├── EndpointEntity.cs │ │ ├── EndpointResponse.cs │ │ ├── ErrorResponse.cs │ │ ├── ExportRequest.cs │ │ ├── FunctionCreateResponse.cs │ │ ├── FunctionRemoveResponse.cs │ │ ├── GraphResponse.cs │ │ ├── QueryResponse.cs │ │ ├── QueryResponseBase.cs │ │ ├── QueryResponseExtra.cs │ │ ├── SingleResult.cs │ │ └── TransactionResponse.cs ├── Relinq │ ├── Clauses │ │ ├── AdditionalFromClause.cs │ │ ├── CloneContext.cs │ │ ├── ExpressionVisitors │ │ │ ├── AccessorFindingExpressionVisitor.cs │ │ │ ├── CloningExpressionVisitor.cs │ │ │ ├── ReferenceReplacingExpressionVisitor.cs │ │ │ └── ReverseResolvingExpressionVisitor.cs │ │ ├── Expressions │ │ │ ├── IPartialEvaluationExceptionExpressionVisitor.cs │ │ │ ├── IVBSpecificExpressionVisitor.cs │ │ │ ├── PartialEvaluationExceptionExpression.cs │ │ │ ├── QuerySourceReferenceExpression.cs │ │ │ ├── SubQueryExpression.cs │ │ │ └── VBStringComparisonExpression.cs │ │ ├── FromClauseBase.cs │ │ ├── GroupJoinClause.cs │ │ ├── IBodyClause.cs │ │ ├── IClause.cs │ │ ├── IFromClause.cs │ │ ├── IQuerySource.cs │ │ ├── JoinClause.cs │ │ ├── MainFromClause.cs │ │ ├── OrderByClause.cs │ │ ├── Ordering.cs │ │ ├── OrderingDirection.cs │ │ ├── QuerySourceMapping.cs │ │ ├── ResultOperatorBase.cs │ │ ├── ResultOperators │ │ │ ├── AggregateFromSeedResultOperator.cs │ │ │ ├── AggregateResultOperator.cs │ │ │ ├── AllResultOperator.cs │ │ │ ├── AnyResultOperator.cs │ │ │ ├── AsQueryableResultOperator.cs │ │ │ ├── AverageResultOperator.cs │ │ │ ├── CastResultOperator.cs │ │ │ ├── ChoiceResultOperatorBase.cs │ │ │ ├── ConcatResultOperator.cs │ │ │ ├── ContainsResultOperator.cs │ │ │ ├── CountResultOperator.cs │ │ │ ├── DefaultIfEmptyResultOperator.cs │ │ │ ├── DistinctResultOperator.cs │ │ │ ├── ExceptResultOperator.cs │ │ │ ├── FirstResultOperator.cs │ │ │ ├── GroupResultOperator.cs │ │ │ ├── IntersectResultOperator.cs │ │ │ ├── LastResultOperator.cs │ │ │ ├── LongCountResultOperator.cs │ │ │ ├── MaxResultOperator.cs │ │ │ ├── MinResultOperator.cs │ │ │ ├── OfTypeResultOperator.cs │ │ │ ├── ReverseResultOperator.cs │ │ │ ├── SequenceFromSequenceResultOperatorBase.cs │ │ │ ├── SequenceTypePreservingResultOperatorBase.cs │ │ │ ├── SingleResultOperator.cs │ │ │ ├── SkipResultOperator.cs │ │ │ ├── SumResultOperator.cs │ │ │ ├── TakeResultOperator.cs │ │ │ ├── UnionResultOperator.cs │ │ │ └── ValueFromSequenceResultOperatorBase.cs │ │ ├── SelectClause.cs │ │ ├── StreamedData │ │ │ ├── IStreamedData.cs │ │ │ ├── IStreamedDataInfo.cs │ │ │ ├── StreamedScalarValueInfo.cs │ │ │ ├── StreamedSequence.cs │ │ │ ├── StreamedSequenceInfo.cs │ │ │ ├── StreamedSingleValueInfo.cs │ │ │ ├── StreamedValue.cs │ │ │ └── StreamedValueInfo.cs │ │ └── WhereClause.cs │ ├── Collections │ │ ├── ChangeResistantObservableCollectionEnumerator.cs │ │ ├── IndexValuePair.cs │ │ ├── MultiDictionaryExtensions.cs │ │ └── ObservableCollectionExtensions.cs │ ├── DefaultQueryProvider.cs │ ├── IQueryExecutor.cs │ ├── IQueryModelVisitor.cs │ ├── Packages │ │ ├── ArgumentUtility.cs │ │ ├── Assertion.cs │ │ ├── AssertionConditionAttribute.cs │ │ ├── AssertionConditionType.cs │ │ ├── AssertionMethodAttribute.cs │ │ ├── BaseTypeRequiredAttribute.cs │ │ ├── CanBeNullAttribute.cs │ │ ├── CannotApplyEqualityOperatorAttribute.cs │ │ ├── ContractAnnotationAttribute.cs │ │ ├── ImplicitUseKindFlags.cs │ │ ├── ImplicitUseTargetFlags.cs │ │ ├── InstantHandleAttribute.cs │ │ ├── InvokerParameterNameAttribute.cs │ │ ├── LinqTunnelAttribute.cs │ │ ├── LocalizationRequiredAttribute.cs │ │ ├── MeansImplicitUseAttribute.cs │ │ ├── NoEnumerationAttribute.cs │ │ ├── NotNullAttribute.cs │ │ ├── NotifyPropertyChangedInvocatorAttribute.cs │ │ ├── NullableTypeUtility.cs │ │ ├── PathReferenceAttribute.cs │ │ ├── PublicAPIAttribute.cs │ │ ├── PureAttribute.cs │ │ ├── StringFormatMethodAttribute.cs │ │ ├── TerminatesProgramAttribute.cs │ │ └── UsedImplicitlyAttribute.cs │ ├── Parsing │ │ ├── ExpressionVisitors │ │ │ ├── MemberBindings │ │ │ │ ├── FieldInfoBinding.cs │ │ │ │ ├── MemberBinding.cs │ │ │ │ ├── MethodInfoBinding.cs │ │ │ │ └── PropertyInfoBinding.cs │ │ │ ├── MultiReplacingExpressionVisitor.cs │ │ │ ├── PartialEvaluatingExpressionVisitor.cs │ │ │ ├── ReplacingExpressionVisitor.cs │ │ │ ├── SubQueryFindingExpressionVisitor.cs │ │ │ ├── Transformation │ │ │ │ ├── ExpressionTransformation.cs │ │ │ │ ├── ExpressionTransformerRegistry.cs │ │ │ │ ├── IExpressionTranformationProvider.cs │ │ │ │ ├── IExpressionTransformer.cs │ │ │ │ └── PredefinedTransformations │ │ │ │ │ ├── AttributeEvaluatingExpressionTransformer.cs │ │ │ │ │ ├── DictionaryEntryNewExpressionTransformer.cs │ │ │ │ │ ├── InvocationOfLambdaExpressionTransformer.cs │ │ │ │ │ ├── KeyValuePairNewExpressionTransformer.cs │ │ │ │ │ ├── MemberAddingNewExpressionTransformerBase.cs │ │ │ │ │ ├── MethodCallExpressionTransformerAttribute.cs │ │ │ │ │ ├── NullableValueTransformer.cs │ │ │ │ │ ├── TupleNewExpressionTransformer.cs │ │ │ │ │ ├── VBCompareStringExpressionTransformer.cs │ │ │ │ │ └── VBInformationIsNothingExpressionTransformer.cs │ │ │ ├── TransformingExpressionVisitor.cs │ │ │ ├── TransparentIdentifierRemovingExpressionVisitor.cs │ │ │ └── TreeEvaluation │ │ │ │ ├── EvaluatableExpressionFilterBase.cs │ │ │ │ ├── EvaluatableTreeFindingExpressionVisitor.cs │ │ │ │ ├── IEvaluatableExpressionFilter.cs │ │ │ │ ├── NullEvaluatableExpressionFilter.cs │ │ │ │ └── PartialEvaluationInfo.cs │ │ ├── ParserException.Obsolete.cs │ │ ├── RelinqExpressionVisitor.cs │ │ ├── Structure │ │ │ ├── ExpressionTreeParser.cs │ │ │ ├── ExpressionTreeProcessors │ │ │ │ ├── CompoundExpressionTreeProcessor.cs │ │ │ │ ├── NullExpressionTreeProcessor.cs │ │ │ │ ├── PartialEvaluatingExpressionTreeProcessor.cs │ │ │ │ └── TransformingExpressionTreeProcessor.cs │ │ │ ├── IExpressionTreeProcessor.cs │ │ │ ├── INodeTypeProvider.cs │ │ │ ├── IQueryParser.cs │ │ │ ├── IntermediateModel │ │ │ │ ├── AggregateExpressionNode.cs │ │ │ │ ├── AggregateFromSeedExpressionNode.cs │ │ │ │ ├── AllExpressionNode.cs │ │ │ │ ├── AnyExpressionNode.cs │ │ │ │ ├── AsQueryableExpressionNode.cs │ │ │ │ ├── AverageExpressionNode.cs │ │ │ │ ├── CastExpressionNode.cs │ │ │ │ ├── ClauseGenerationContext.cs │ │ │ │ ├── ConcatExpressionNode.cs │ │ │ │ ├── ContainsExpressionNode.cs │ │ │ │ ├── CountExpressionNode.cs │ │ │ │ ├── DefaultIfEmptyExpressionNode.cs │ │ │ │ ├── DistinctExpressionNode.cs │ │ │ │ ├── ExceptExpressionNode.cs │ │ │ │ ├── ExpressionNodeInstantiationException.cs │ │ │ │ ├── ExpressionResolver.cs │ │ │ │ ├── FirstExpressionNode.cs │ │ │ │ ├── GroupByExpressionNode.cs │ │ │ │ ├── GroupByWithResultSelectorExpressionNode.cs │ │ │ │ ├── GroupJoinExpressionNode.cs │ │ │ │ ├── IExpressionNode.cs │ │ │ │ ├── IQuerySourceExpressionNode.cs │ │ │ │ ├── IntersectExpressionNode.cs │ │ │ │ ├── JoinExpressionNode.cs │ │ │ │ ├── LastExpressionNode.cs │ │ │ │ ├── LongCountExpressionNode.cs │ │ │ │ ├── MainSourceExpressionNode.cs │ │ │ │ ├── MaxExpressionNode.cs │ │ │ │ ├── MethodCallExpressionNodeBase.cs │ │ │ │ ├── MethodCallExpressionNodeFactory.cs │ │ │ │ ├── MethodCallExpressionParseInfo.cs │ │ │ │ ├── MinExpressionNode.cs │ │ │ │ ├── OfTypeExpressionNode.cs │ │ │ │ ├── OrderByDescendingExpressionNode.cs │ │ │ │ ├── OrderByExpressionNode.cs │ │ │ │ ├── QuerySourceExpressionNodeUtility.cs │ │ │ │ ├── QuerySourceSetOperationExpressionNodeBase.cs │ │ │ │ ├── ResolvedExpressionCache.cs │ │ │ │ ├── ResultOperatorExpressionNodeBase.cs │ │ │ │ ├── ReverseExpressionNode.cs │ │ │ │ ├── SelectExpressionNode.cs │ │ │ │ ├── SelectManyExpressionNode.cs │ │ │ │ ├── SingleExpressionNode.cs │ │ │ │ ├── SkipExpressionNode.cs │ │ │ │ ├── SumExpressionNode.cs │ │ │ │ ├── SupportedMethodSpecifications.cs │ │ │ │ ├── TakeExpressionNode.cs │ │ │ │ ├── ThenByDescendingExpressionNode.cs │ │ │ │ ├── ThenByExpressionNode.cs │ │ │ │ ├── UnionExpressionNode.cs │ │ │ │ └── WhereExpressionNode.cs │ │ │ ├── MethodCallExpressionParser.cs │ │ │ ├── NodeTypeProviders │ │ │ │ ├── CompoundNodeTypeProvider.cs │ │ │ │ ├── MethodInfoBasedNodeTypeRegistry.cs │ │ │ │ ├── MethodNameBasedNodeTypeRegistry.cs │ │ │ │ └── NameBasedRegistrationInfo.cs │ │ │ └── QueryParser.cs │ │ ├── ThrowingExpressionVisitor.cs │ │ └── TupleExpressionBuilder.cs │ ├── QueryModel.cs │ ├── QueryModelBuilder.cs │ ├── QueryModelVisitorBase.cs │ ├── QueryProviderBase.cs │ ├── QueryableBase.cs │ ├── Transformations │ │ └── SubQueryFromClauseFlattener.cs │ ├── UniqueIdentifierGenerator.cs │ └── Utilities │ │ ├── ExpressionExtensions.cs │ │ ├── ItemTypeReflectionUtility.cs │ │ ├── ReflectionExtensions.cs │ │ ├── ReflectionUtility.cs │ │ └── StringUtility.cs ├── Serialization │ ├── IArangoFormattable.cs │ ├── IArangoSerializer.cs │ ├── Json │ │ ├── ArangoJsonCamelCasePolicy.cs │ │ ├── ArangoJsonDefaultPolicy.cs │ │ ├── ArangoJsonSerializer.cs │ │ ├── JsonStringEnumMemberConverter.cs │ │ └── JsonStringEnumMemberConverterHelper.cs │ └── Newtonsoft │ │ ├── ArangoNewtonsoftCamelCaseContractResolver.cs │ │ ├── ArangoNewtonsoftDefaultContractResolver.cs │ │ └── ArangoNewtonsoftSerializer.cs └── Transport │ ├── ArangoHttpTransport.cs │ └── IArangoTransport.cs ├── LICENSE ├── NOTICE ├── README.md └── docker ├── clean_cluster.sh ├── clean_single.sh ├── debug_containers_cluster.sh ├── debug_containers_single.sh ├── server.pem ├── start_db_cluster.sh ├── start_db_cluster_retry_fail.sh ├── start_db_cluster_ssl.sh ├── start_db_single.sh ├── start_db_single_retry_fail.sh └── start_db_single_ssl.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # Remove the line below if you want to inherit .editorconfig settings from higher directories 2 | root = true 3 | 4 | # C# files 5 | [*.cs] 6 | 7 | #### Core EditorConfig Options #### 8 | 9 | # Indentation and spacing 10 | indent_size = 4 11 | indent_style = space 12 | tab_width = 4 -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | timeout-minutes: 20 15 | runs-on: ubuntu-latest 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | dotnet: 21 | - 9.x 22 | arango: 23 | - "arangodb:3.11" 24 | # - "arangodb:3.10" 25 | # - "arangodb/enterprise:3.9" 26 | topology: 27 | - single 28 | # - cluster 29 | 30 | steps: 31 | - uses: actions/checkout@v3 32 | 33 | - name: chmod 34 | run: find ./docker -name '*.sh' | xargs chmod +x 35 | 36 | - name: arango 37 | run: ./docker/start_db_${{ matrix.topology }}_retry_fail.sh ${{ matrix.arango }} 38 | env: 39 | ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }} 40 | 41 | - name: dotnet 42 | uses: actions/setup-dotnet@v3 43 | with: 44 | dotnet-version: ${{ matrix.dotnet }} 45 | 46 | - name: build 47 | run: dotnet build --configuration Release 48 | 49 | - name: test 50 | run: dotnet test --configuration Release 51 | env: 52 | ARANGODB_CONNECTION: "Server=http://172.28.3.1:8529;Realm=CI-{UUID};User=root;Password=test;" 53 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*.*.*' 7 | 8 | jobs: 9 | build: 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: Setup 17 | uses: actions/setup-dotnet@v3 18 | with: 19 | dotnet-version: 9.x 20 | 21 | - name: Build Version 22 | id: vars 23 | run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" 24 | 25 | - name: Apply Version 26 | uses: jacobtomlinson/gha-find-replace@v2 27 | with: 28 | find: ".*<\\/Version>" 29 | replace: "${{ steps.vars.outputs.VERSION }}" 30 | include: "**/Core.Arango.csproj" 31 | regex: true 32 | 33 | - name: Build 34 | run: dotnet build --configuration Release 35 | 36 | - name: Pack 37 | run: dotnet pack --configuration Release 38 | 39 | - name: Publish 40 | run: dotnet nuget push **/*.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | .idea 3 | bin 4 | obj 5 | *.user 6 | *.suo -------------------------------------------------------------------------------- /Core.Arango.Tests/BackupTest.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Tests 2 | { 3 | /*public class BackupTest : TestBase 4 | { 5 | [Fact] 6 | public async Task BackupRestoreDelete() 7 | { 8 | await SetupAsync("system-camel"); 9 | 10 | var version = await Arango.GetVersionAsync(); 11 | 12 | if (version.License != "enterprise") 13 | return; 14 | 15 | var backup = await Arango.Backup.CreateAsync(new ArangoBackupRequest 16 | { 17 | AllowInconsistent = false, 18 | Force = true, 19 | Label = "test", 20 | Timeout = 30 21 | }); 22 | 23 | await Task.Delay(1000); 24 | await Arango.Backup.ListAsync(); 25 | 26 | await Arango.Backup.RestoreAsync(backup.Id); 27 | 28 | await Task.Delay(1000); 29 | await Arango.Backup.DeleteAsync(backup.Id); 30 | } 31 | }*/ 32 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/CamelCaseTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Core.Arango.Protocol; 4 | using Core.Arango.Tests.Core; 5 | using Xunit; 6 | 7 | namespace Core.Arango.Tests 8 | { 9 | public class CamelCaseTest : TestBase 10 | { 11 | [Theory] 12 | [ClassData(typeof(CamelCaseData))] 13 | public async Task GetCamelCase(string serializer) 14 | { 15 | await SetupAsync(serializer); 16 | await Arango.Collection.CreateAsync("test", "test", ArangoCollectionType.Document); 17 | 18 | await Arango.Document.CreateAsync("test", "test", new 19 | { 20 | Key = "abc", 21 | Name = "a", 22 | SomeName = "b" 23 | }); 24 | 25 | var doc = await Arango.Document.GetAsync>("test", "test", "abc"); 26 | 27 | Assert.Equal("a", doc["name"]); 28 | Assert.Equal("b", doc["someName"]); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/Core.Arango.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net9.0 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | all 22 | runtime; build; native; contentfiles; analyzers; buildtransitive 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Core.Arango.Tests/Core/CamelCaseData.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Core.Arango.Tests.Core 4 | { 5 | public class CamelCaseData : TheoryData 6 | { 7 | public CamelCaseData() 8 | { 9 | Add("newton-camel"); 10 | Add("system-camel"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/Core/PascalCaseData.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | namespace Core.Arango.Tests.Core 4 | { 5 | public class PascalCaseData : TheoryData 6 | { 7 | public PascalCaseData() 8 | { 9 | Add("newton-default"); 10 | Add("system-default"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/DatabaseTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Core.Arango.Protocol; 4 | using Core.Arango.Tests.Core; 5 | using Xunit; 6 | using Xunit.Abstractions; 7 | 8 | namespace Core.Arango.Tests 9 | { 10 | public class DatabaseTest : TestBase 11 | { 12 | private readonly ITestOutputHelper _output; 13 | 14 | public DatabaseTest(ITestOutputHelper output) 15 | { 16 | _output = output; 17 | } 18 | 19 | [Theory] 20 | [ClassData(typeof(PascalCaseData))] 21 | public async Task Create(string serializer) 22 | { 23 | await SetupAsync(serializer, null); 24 | 25 | await Arango.Database.CreateAsync("test"); 26 | await Arango.Database.CreateAsync(new ArangoDatabase 27 | { 28 | Name = "test2" 29 | }); 30 | await Arango.Database.ListAsync(); 31 | 32 | Assert.True(await Arango.Database.ExistAsync("test")); 33 | Assert.True(await Arango.Database.ExistAsync("test2")); 34 | Assert.False(await Arango.Database.ExistAsync("test3")); 35 | 36 | var info = await Arango.Database.GetAsync("test"); 37 | Assert.EndsWith("-test",info.Name); 38 | } 39 | 40 | [Theory] 41 | [ClassData(typeof(PascalCaseData))] 42 | public async Task Drop(string serializer) 43 | { 44 | await SetupAsync(serializer, null); 45 | 46 | await Arango.Database.CreateAsync("test"); 47 | await Arango.Database.DropAsync("test"); 48 | 49 | var ex = await Assert.ThrowsAsync(async () => 50 | { 51 | await Arango.Database.DropAsync("test2"); 52 | }); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/DependencyInjectionTest.cs: -------------------------------------------------------------------------------- 1 | using Core.Arango.Tests.Core; 2 | using Microsoft.Extensions.DependencyInjection; 3 | using Xunit; 4 | 5 | namespace Core.Arango.Tests 6 | { 7 | public class DependencyInjectionTest : TestBase 8 | { 9 | [Fact] 10 | public void AddArangoConfigurationCallback() 11 | { 12 | var collection = new ServiceCollection(); 13 | 14 | collection.AddArango((sp, config) => 15 | { 16 | config.ConnectionString = UniqueTestRealm(); 17 | config.BatchSize = 1337; 18 | }); 19 | 20 | var serviceProvider = collection.BuildServiceProvider(); 21 | Arango = serviceProvider.GetRequiredService(); 22 | 23 | Arango.GetVersionAsync(); 24 | 25 | Assert.Equal(1337, Arango.Configuration.BatchSize); 26 | } 27 | 28 | [Fact] 29 | public void AddArangoConnectionStringCallback() 30 | { 31 | var collection = new ServiceCollection(); 32 | 33 | collection.AddArango(sp => UniqueTestRealm()); 34 | 35 | var serviceProvider = collection.BuildServiceProvider(); 36 | Arango = serviceProvider.GetRequiredService(); 37 | 38 | Arango.GetVersionAsync(); 39 | } 40 | 41 | [Fact] 42 | public void AddArangoConnectionString() 43 | { 44 | var collection = new ServiceCollection(); 45 | 46 | collection.AddArango(UniqueTestRealm()); 47 | 48 | var serviceProvider = collection.BuildServiceProvider(); 49 | Arango = serviceProvider.GetRequiredService(); 50 | 51 | Arango.GetVersionAsync(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/FoxxTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coronabytes/dotnet-arangodb/8dc1b7e34bc9d1abbf8d13e7a31c8b402cf2fee6/Core.Arango.Tests/FoxxTest.cs -------------------------------------------------------------------------------- /Core.Arango.Tests/IndexTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading.Tasks; 3 | using Core.Arango.Protocol; 4 | using Core.Arango.Tests.Core; 5 | using Xunit; 6 | 7 | namespace Core.Arango.Tests 8 | { 9 | public class IndexTest : TestBase 10 | { 11 | [Theory] 12 | [ClassData(typeof(PascalCaseData))] 13 | public async Task DropAll(string serializer) 14 | { 15 | await SetupAsync(serializer); 16 | await Arango.Collection.CreateAsync("test", "test", ArangoCollectionType.Document); 17 | 18 | await Arango.Index.CreateAsync("test", "test", new ArangoIndex 19 | { 20 | Fields = new List {"test"}, 21 | Type = ArangoIndexType.Hash 22 | }); 23 | 24 | await Arango.Index.DropAllAsync("test"); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/QueryFormattingTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | using Core.Arango.Tests.Core; 6 | using Xunit; 7 | 8 | namespace Core.Arango.Tests 9 | { 10 | public class QueryFormattingTest : TestBase 11 | { 12 | [Theory] 13 | [ClassData(typeof(PascalCaseData))] 14 | public async Task GuidFormat(string serializer) 15 | { 16 | await SetupAsync(serializer); 17 | await Arango.Collection.CreateAsync("test", "test", ArangoCollectionType.Document); 18 | 19 | var userKey = Guid.Parse("{867E46A9-3623-4D7B-B33A-9E24F0E7D660}"); 20 | var clientKey = Guid.Parse("{8038F24B-AF91-4E7D-BAFE-1D96DF7FD06A}"); 21 | 22 | var user = await Arango.Query.SingleOrDefaultAsync("test", "test", 23 | $"x._key == {userKey} && x.ClientKey == {clientKey}"); 24 | } 25 | 26 | [Theory] 27 | [ClassData(typeof(PascalCaseData))] 28 | public async Task DateTimeFormat(string serializer) 29 | { 30 | await SetupAsync(serializer); 31 | await Arango.Collection.CreateAsync("test", "test", ArangoCollectionType.Document); 32 | 33 | var date = new DateTime(2020, 12, 4, 9, 58, 25, DateTimeKind.Utc); 34 | 35 | var resultDefault = (await Arango.Query.ExecuteAsync("test", $"LET v = {date} RETURN v")) 36 | .SingleOrDefault(); 37 | 38 | Assert.Equal("2020-12-04T09:58:25Z", resultDefault); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Core.Arango.Tests/QueryStatisticTest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | using Core.Arango.Tests.Core; 6 | using Newtonsoft.Json; 7 | using Xunit; 8 | using Xunit.Abstractions; 9 | 10 | namespace Core.Arango.Tests 11 | { 12 | public class QueryStatisticTest(ITestOutputHelper output) : TestBase 13 | { 14 | public override async Task InitializeAsync() 15 | { 16 | Arango = 17 | new ArangoContext(UniqueTestRealm(), 18 | new ArangoConfiguration 19 | { 20 | QueryProfile = (query, bindVars, stats) => 21 | { 22 | var boundQuery = query; 23 | 24 | foreach (var p in bindVars.OrderByDescending(x => x.Key.Length)) 25 | boundQuery = boundQuery.Replace("@" + p.Key, JsonConvert.SerializeObject(p.Value)); 26 | 27 | output.WriteLine( 28 | $"{boundQuery}\n{JsonConvert.SerializeObject(stats, Formatting.Indented)}"); 29 | } 30 | }); 31 | await Arango.Database.CreateAsync("test"); 32 | } 33 | 34 | [Fact] 35 | public async Task QueryStats() 36 | { 37 | await Arango.Collection.CreateAsync("test", "test", ArangoCollectionType.Document); 38 | 39 | await Arango.Document.CreateManyAsync("test", "test", new List 40 | { 41 | new() {Value = 1}, 42 | new() {Value = 2}, 43 | new() {Value = 3}, 44 | new() {Value = 4}, 45 | new() {Value = 5} 46 | }); 47 | 48 | var select = new List {1, 2, 3}; 49 | 50 | var res = await Arango.Query.ExecuteAsync("test", 51 | $"FOR e IN test FILTER e.Value IN {select} LIMIT 2 RETURN e", fullCount: true); 52 | 53 | Assert.Equal(2, res.Count); 54 | Assert.Equal(3, res.FullCount); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /Core.Arango.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.9.34723.18 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Arango", "Core.Arango\Core.Arango.csproj", "{6B8D05CE-CCB7-4FC4-A85F-EADDEF305999}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core.Arango.Tests", "Core.Arango.Tests\Core.Arango.Tests.csproj", "{F31E2F80-FFFB-43DA-9C6B-971B854D1E35}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{13D67C1C-3066-4412-A1F6-9C9AD13B7C81}" 11 | ProjectSection(SolutionItems) = preProject 12 | .editorconfig = .editorconfig 13 | EndProjectSection 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {6B8D05CE-CCB7-4FC4-A85F-EADDEF305999}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {6B8D05CE-CCB7-4FC4-A85F-EADDEF305999}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {6B8D05CE-CCB7-4FC4-A85F-EADDEF305999}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {6B8D05CE-CCB7-4FC4-A85F-EADDEF305999}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {F31E2F80-FFFB-43DA-9C6B-971B854D1E35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {F31E2F80-FFFB-43DA-9C6B-971B854D1E35}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {F31E2F80-FFFB-43DA-9C6B-971B854D1E35}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {F31E2F80-FFFB-43DA-9C6B-971B854D1E35}.Release|Any CPU.Build.0 = Release|Any CPU 29 | EndGlobalSection 30 | GlobalSection(SolutionProperties) = preSolution 31 | HideSolutionNode = FALSE 32 | EndGlobalSection 33 | GlobalSection(ExtensibilityGlobals) = postSolution 34 | SolutionGuid = {D52A3509-0AEE-4464-81B6-E4E4AA95E7ED} 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /Core.Arango.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True 3 | True -------------------------------------------------------------------------------- /Core.Arango/ArangoDB.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coronabytes/dotnet-arangodb/8dc1b7e34bc9d1abbf8d13e7a31c8b402cf2fee6/Core.Arango/ArangoDB.png -------------------------------------------------------------------------------- /Core.Arango/ArangoException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | using System.Net; 6 | using Core.Arango.Protocol; 7 | 8 | namespace Core.Arango 9 | { 10 | /// 11 | /// Generic Arango exception 12 | /// 13 | public class ArangoException : Exception 14 | { 15 | /// 16 | /// 17 | public ArangoException(string msg) : base(msg) 18 | { 19 | } 20 | 21 | /// 22 | /// 23 | public ArangoException(string msg, string errorMessage, HttpStatusCode code, ArangoErrorCode errorNumber) 24 | : base(msg) 25 | { 26 | ErrorMessage = errorMessage; 27 | Code = code; 28 | ErrorNumber = errorNumber; 29 | } 30 | 31 | /// 32 | /// 33 | public ArangoException(string msg, IEnumerable errors) 34 | : base(msg) 35 | { 36 | Errors = new ReadOnlyCollection(errors.ToArray()); 37 | } 38 | 39 | /// 40 | /// Error message 41 | /// 42 | public string ErrorMessage { get; } 43 | 44 | /// 45 | /// HTTP status code 46 | /// 47 | public HttpStatusCode? Code { get; } 48 | 49 | /// 50 | /// Arango error code 51 | /// 52 | public ArangoErrorCode? ErrorNumber { get; } 53 | 54 | /// 55 | /// Error descriptions 56 | /// 57 | public IReadOnlyList Errors { get; } 58 | } 59 | } -------------------------------------------------------------------------------- /Core.Arango/ArangoIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango 4 | { 5 | /// 6 | /// Json.NET Only - Mark properties to be ignored from being written to ArangoDB 7 | /// 8 | [AttributeUsage(AttributeTargets.Property)] 9 | public class ArangoIgnoreAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/ArangoList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Core.Arango 4 | { 5 | /// 6 | /// Generic List with fullcount extension 7 | /// 8 | public class ArangoList : List 9 | { 10 | /// 11 | /// Actual result count of query ignoring LIMIT clause 12 | /// 13 | public long? FullCount { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Aql.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using Core.Arango.Linq.Attributes; 4 | 5 | namespace Core.Arango.Linq 6 | { 7 | /// 8 | /// Built-on AQL functions 9 | /// 10 | [SuppressMessage("CodeQuality", "IDE0060")] 11 | public partial class Aql 12 | { 13 | private static Exception E => new NotImplementedException(); 14 | 15 | /// 16 | /// Force return type (not an actual function) 17 | /// 18 | public static T As(object v) 19 | { 20 | throw E; 21 | } 22 | 23 | /// 24 | /// Access to new document version 25 | /// 26 | [AqlFunction("NEW", true)] 27 | public static T New() 28 | { 29 | throw E; 30 | } 31 | 32 | /// 33 | /// Access to old document version 34 | /// 35 | [AqlFunction("OLD", true)] 36 | public static T Old() 37 | { 38 | throw E; 39 | } 40 | 41 | /// 42 | /// Calculate the FNV-1A 64 bit hash for text and return it in a hexadecimal string representation. 43 | /// 44 | [AqlFunction("FNV64")] 45 | public static string Fnv64(object value) 46 | { 47 | throw E; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/ArangoContextExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using Core.Arango.Linq.Query; 4 | 5 | namespace Core.Arango.Linq 6 | { 7 | /// 8 | /// LINQ Extensions 9 | /// 10 | public static class ArangoContextExtension 11 | { 12 | /// 13 | /// LINQ in sub-expression 14 | /// 15 | public static IQueryable Query(this IArangoContext context) 16 | { 17 | var queryParser = new AqlParser(new ArangoLinq(context, null)); 18 | return queryParser.CreateQueryable(); 19 | } 20 | 21 | /// 22 | /// LINQ on database 23 | /// 24 | public static IQueryable Query(this IArangoContext context, ArangoHandle handle) 25 | { 26 | var queryParser = new AqlParser(new ArangoLinq(context, handle)); 27 | return queryParser.CreateQueryable(); 28 | } 29 | 30 | /// 31 | /// LINQ in sub-expression 32 | /// 33 | public static IQueryable Query(this IArangoContext context) 34 | { 35 | var queryParser = new AqlParser(new ArangoLinq(context, null)); 36 | return queryParser.CreateQueryable(); 37 | } 38 | 39 | /// 40 | /// LINQ on database 41 | /// 42 | public static IQueryable Query(this IArangoContext context, ArangoHandle handle) 43 | { 44 | var queryParser = new AqlParser(new ArangoLinq(context, handle)); 45 | return queryParser.CreateQueryable(); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Attributes/AqlFunctionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango.Linq.Attributes 4 | { 5 | /// 6 | /// LINQ Arango Function 7 | /// 8 | [AttributeUsage(AttributeTargets.Method)] 9 | public class AqlFunctionAttribute : Attribute 10 | { 11 | /// 12 | /// 13 | /// 14 | public AqlFunctionAttribute(string name) 15 | { 16 | Name = name; 17 | } 18 | 19 | /// 20 | /// 21 | /// 22 | public AqlFunctionAttribute(string name, bool isProperty) 23 | { 24 | Name = name; 25 | IsProperty = isProperty; 26 | } 27 | 28 | /// 29 | /// 30 | /// 31 | public string Name { get; } 32 | 33 | /// 34 | /// 35 | /// 36 | public bool IsProperty { get; } 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Attributes/CollectionPropertyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Core.Arango.Linq.Interface; 3 | 4 | namespace Core.Arango.Linq.Attributes 5 | { 6 | [AttributeUsage(AttributeTargets.Class)] 7 | public class CollectionPropertyAttribute : Attribute, ICollectionPropertySetting 8 | { 9 | public string CollectionName { get; set; } 10 | 11 | public NamingConvention Naming { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Collection/EdgeDirection.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Linq.Collection 2 | { 3 | public enum EdgeDirection 4 | { 5 | Any = 0, 6 | Inbound = 1, 7 | Outbound = 2 8 | } 9 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/BaseResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Linq.Data 5 | { 6 | public class BaseResult 7 | { 8 | public int? Code { get; set; } 9 | 10 | public bool? Error { get; set; } 11 | 12 | public string ErrorMessage { get; set; } 13 | 14 | public int? ErrorNum { get; set; } 15 | 16 | public bool HasError() 17 | { 18 | return Error == true; 19 | } 20 | 21 | protected void SetProperties(BaseResult baseResult) 22 | { 23 | Code = baseResult.Code; 24 | Error = baseResult.Error; 25 | ErrorMessage = baseResult.ErrorMessage; 26 | ErrorNum = baseResult.ErrorNum; 27 | } 28 | 29 | internal virtual void SetFromJsonTextReader(string name, JsonToken token, object value) 30 | { 31 | if (name == "code" && token == JsonToken.Integer) 32 | Code = Convert.ToInt32(value); 33 | 34 | if (name == "error" && token == JsonToken.Boolean) 35 | Error = Convert.ToBoolean(value); 36 | 37 | if (name == "errorMessage" && token == JsonToken.String) 38 | ErrorMessage = value.ToString(); 39 | 40 | if (name == "errorNum" && token == JsonToken.Integer) 41 | ErrorNum = Convert.ToInt32(value); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/EdgeVertexResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Core.Arango.Linq.Attributes; 3 | using Core.Arango.Linq.Interface; 4 | 5 | namespace Core.Arango.Linq.Data 6 | { 7 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 8 | public class EdgeVertexResult 9 | { 10 | public TEdge Edge { get; set; } 11 | 12 | public TVertex Vertex { get; set; } 13 | } 14 | 15 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 16 | public class AQLTraversalResult 17 | { 18 | public TVertex Vertex { get; set; } 19 | 20 | public TraversalVisitedPathResult Path { get; set; } 21 | } 22 | 23 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 24 | public class ShortestPathResult 25 | { 26 | public List Vertices { get; set; } 27 | 28 | public List Edges { get; set; } 29 | 30 | public int Distance { get; set; } 31 | } 32 | 33 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 34 | public class PathResult 35 | { 36 | public List Vertices { get; set; } 37 | 38 | public List Edges { get; set; } 39 | 40 | public TVertex Source { get; set; } 41 | 42 | public TVertex Destination { get; set; } 43 | } 44 | 45 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 46 | public class GraphCommonNeighborsResult 47 | { 48 | public string Left { get; set; } 49 | 50 | public string Right { get; set; } 51 | 52 | public List Neighbors { get; set; } 53 | } 54 | 55 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 56 | public class GraphDistanceToResult 57 | { 58 | public string StartVertex { get; set; } 59 | 60 | public string Vertex { get; set; } 61 | 62 | public int Distance { get; set; } 63 | } 64 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/ShortestPathData.cs: -------------------------------------------------------------------------------- 1 | using Core.Arango.Linq.Attributes; 2 | using Core.Arango.Linq.Interface; 3 | 4 | namespace Core.Arango.Linq.Data 5 | { 6 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 7 | public class ShortestPathData 8 | { 9 | public TVertex Vertex { get; set; } 10 | 11 | public TEdge Edge { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/TraversalData.cs: -------------------------------------------------------------------------------- 1 | using Core.Arango.Linq.Attributes; 2 | using Core.Arango.Linq.Interface; 3 | 4 | namespace Core.Arango.Linq.Data 5 | { 6 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 7 | public class TraversalData 8 | { 9 | public TVertex Vertex { get; set; } 10 | 11 | public TEdge Edge { get; set; } 12 | 13 | public TraversalPathData Path { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/TraversalEdgeDefinition.cs: -------------------------------------------------------------------------------- 1 | using Core.Arango.Linq.Collection; 2 | 3 | namespace Core.Arango.Linq.Data 4 | { 5 | public class TraversalEdgeDefinition 6 | { 7 | public string CollectionName { get; set; } 8 | 9 | public EdgeDirection? Direction { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/TraversalPathData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Core.Arango.Linq.Attributes; 3 | using Core.Arango.Linq.Interface; 4 | 5 | namespace Core.Arango.Linq.Data 6 | { 7 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 8 | public class TraversalPathData 9 | { 10 | public IList Vertices { get; set; } 11 | 12 | public IList Edges { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Data/TraversalResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Core.Arango.Linq.Attributes; 3 | using Core.Arango.Linq.Interface; 4 | 5 | namespace Core.Arango.Linq.Data 6 | { 7 | public class TraversalContainerResult : BaseResult 8 | { 9 | public TraversalResult Result { get; set; } 10 | } 11 | 12 | public class TraversalResult : BaseResult 13 | { 14 | public TraversalVisitedResult Visited { get; set; } 15 | } 16 | 17 | public class TraversalVisitedResult 18 | { 19 | public List Vertices { get; set; } 20 | 21 | public List> Paths { get; set; } 22 | } 23 | 24 | [CollectionProperty(Naming = NamingConvention.ToCamelCase)] 25 | public class TraversalVisitedPathResult 26 | { 27 | public List Vertices { get; set; } 28 | 29 | public List Edges { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/IAqlModifiable.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Core.Arango.Linq.Interface 4 | { 5 | public interface IAqlModifiable : IQueryable, IOrderedQueryable 6 | { 7 | } 8 | 9 | public interface IAqlModifiable : IAqlModifiable, IQueryable, IOrderedQueryable 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/IArangoLinq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | 6 | namespace Core.Arango.Linq.Interface 7 | { 8 | internal interface IArangoLinq 9 | { 10 | public Func TranslateGroupByIntoName { get; } 11 | public string ResolvePropertyName(Type t, string s); 12 | public string ResolveCollectionName(Type t); 13 | public IAsyncEnumerable StreamAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default); 14 | public ValueTask> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default); 15 | } 16 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/ICollectionPropertySetting.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Linq.Interface 2 | { 3 | public interface ICollectionPropertySetting 4 | { 5 | string CollectionName { get; set; } 6 | 7 | NamingConvention Naming { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/IDocumentPropertySetting.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Linq.Interface 2 | { 3 | public enum NamingConvention 4 | { 5 | UnChanged = 0, 6 | ToCamelCase = 1 7 | } 8 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/IShortestPathQueryable.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Core.Arango.Linq.Interface 4 | { 5 | public interface IShortestPathQueryable : IOrderedQueryable 6 | { 7 | } 8 | 9 | public interface IShortestPathQueryable : IShortestPathQueryable, IOrderedQueryable 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Interface/ITraversalQueryable.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Core.Arango.Linq.Interface 4 | { 5 | public interface ITraversalQueryable : IOrderedQueryable 6 | { 7 | } 8 | 9 | public interface ITraversalQueryable : ITraversalQueryable, IOrderedQueryable 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Internal/ArangoLinq.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Threading; 4 | using System.Threading.Tasks; 5 | using Core.Arango.Linq.Interface; 6 | 7 | namespace Core.Arango.Linq 8 | { 9 | internal class ArangoLinq : IArangoLinq 10 | { 11 | private readonly IArangoContext _context; 12 | private readonly ArangoHandle _handle; 13 | 14 | public ArangoLinq(IArangoContext context, ArangoHandle handle) 15 | { 16 | _context = context; 17 | _handle = handle; 18 | } 19 | 20 | public string ResolvePropertyName(Type t, string s) 21 | { 22 | return _context.Configuration.ResolveProperty(t, s); 23 | } 24 | 25 | public string ResolveCollectionName(Type t) 26 | { 27 | return _context.Configuration.ResolveCollection(t); 28 | } 29 | 30 | public Func TranslateGroupByIntoName => _context.Configuration.ResolveGroupBy; 31 | 32 | public IAsyncEnumerable StreamAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default) 33 | { 34 | return _context.Query.ExecuteStreamAsync(_handle, query, bindVars, cancellationToken: cancellationToken); 35 | } 36 | 37 | public async ValueTask> ExecuteAsync(string query, IDictionary bindVars, CancellationToken cancellationToken = default) 38 | { 39 | return await _context.Query.ExecuteAsync(_handle, query, bindVars, cancellationToken: cancellationToken).ConfigureAwait(false); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/ArangoQueryExecuter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Core.Arango.Linq.Interface; 4 | using Core.Arango.Relinq; 5 | 6 | namespace Core.Arango.Linq.Query 7 | { 8 | internal class ArangoQueryExecuter : IQueryExecutor 9 | { 10 | private readonly IArangoLinq db; 11 | 12 | public ArangoQueryExecuter(IArangoLinq db) 13 | { 14 | this.db = db; 15 | } 16 | 17 | public T ExecuteScalar(QueryModel queryModel) 18 | { 19 | return ExecuteCollection(queryModel).Single(); 20 | } 21 | 22 | public T ExecuteSingle(QueryModel queryModel, bool returnDefaultWhenEmpty) 23 | { 24 | return returnDefaultWhenEmpty 25 | ? ExecuteCollection(queryModel).SingleOrDefault() 26 | : ExecuteCollection(queryModel).Single(); 27 | } 28 | 29 | public IEnumerable ExecuteCollection(QueryModel queryModel) 30 | { 31 | var visitor = new ArangoModelVisitor(db); 32 | visitor.VisitQueryModel(queryModel); 33 | visitor.QueryData.Query = visitor.QueryText.ToString(); 34 | 35 | return db.ExecuteAsync(visitor.QueryData.Query, visitor.QueryData.BindVars).Result.AsEnumerable(); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/FilterClause.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using Core.Arango.Relinq; 4 | using Core.Arango.Relinq.Clauses; 5 | 6 | namespace Core.Arango.Linq.Query.Clause 7 | { 8 | internal sealed class FilterClause : IBodyClause 9 | { 10 | private Expression _predicate; 11 | 12 | public FilterClause(Expression predicate) 13 | { 14 | LinqUtility.CheckNotNull("predicate", predicate); 15 | _predicate = predicate; 16 | } 17 | 18 | public Expression Predicate 19 | { 20 | get => _predicate; 21 | set => _predicate = LinqUtility.CheckNotNull("value", value); 22 | } 23 | 24 | public void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index) 25 | { 26 | LinqUtility.CheckNotNull("visitor", visitor); 27 | LinqUtility.CheckNotNull("queryModel", queryModel); 28 | 29 | var visotor = visitor as ArangoModelVisitor; 30 | 31 | if (visotor == null) 32 | throw new Exception("QueryModelVisitor should be type of ArangoModelVisitor"); 33 | 34 | visotor.VisitFilterClause(this, queryModel, index); 35 | } 36 | 37 | public void TransformExpressions(Func transformation) 38 | { 39 | LinqUtility.CheckNotNull("transformation", transformation); 40 | Predicate = transformation(Predicate); 41 | } 42 | 43 | IBodyClause IBodyClause.Clone(CloneContext cloneContext) 44 | { 45 | return Clone(cloneContext); 46 | } 47 | 48 | public FilterClause Clone(CloneContext cloneContext) 49 | { 50 | LinqUtility.CheckNotNull("cloneContext", cloneContext); 51 | 52 | var clone = new FilterClause(Predicate); 53 | return clone; 54 | } 55 | 56 | public override string ToString() 57 | { 58 | return "filter " + Predicate; 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/IModificationClause.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango.Linq.Query.Clause 4 | { 5 | internal interface IModificationClause 6 | { 7 | string ItemName { get; set; } 8 | 9 | Type CollectionType { get; set; } 10 | 11 | bool IgnoreSelect { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/ITraversalClause.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq.Expressions; 3 | using Core.Arango.Linq.Data; 4 | 5 | namespace Core.Arango.Linq.Query.Clause 6 | { 7 | internal interface ITraversalClause 8 | { 9 | string GraphName { get; set; } 10 | 11 | List EdgeCollections { get; set; } 12 | 13 | string Identifier { get; set; } 14 | 15 | ConstantExpression Options { get; set; } 16 | 17 | ConstantExpression Min { get; set; } 18 | 19 | ConstantExpression Max { get; set; } 20 | 21 | ConstantExpression Direction { get; set; } 22 | 23 | Expression StartVertex { get; set; } 24 | 25 | Expression TargetVertex { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/IgnoreModificationSelectExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq.Expressions; 2 | using System.Reflection; 3 | using Core.Arango.Relinq; 4 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 5 | 6 | namespace Core.Arango.Linq.Query.Clause 7 | { 8 | internal class IgnoreModificationSelectExpressionNode : MethodCallExpressionNodeBase 9 | { 10 | public static readonly MethodInfo[] SupportedMethods = 11 | { 12 | LinqUtility.GetSupportedMethod(() => ArangoQueryableExtensions.IgnoreModificationSelect(null)) 13 | }; 14 | 15 | public IgnoreModificationSelectExpressionNode(MethodCallExpressionParseInfo parseInfo) 16 | : base(parseInfo) 17 | { 18 | } 19 | 20 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 21 | ClauseGenerationContext clauseGenerationContext) 22 | { 23 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 24 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 25 | 26 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 27 | } 28 | 29 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 30 | ClauseGenerationContext clauseGenerationContext) 31 | { 32 | LinqUtility.CheckNotNull("queryModel", queryModel); 33 | 34 | var modificationClause = queryModel.BodyClauses.NextBodyClause(); 35 | modificationClause.IgnoreSelect = true; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/InModificationExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class InModificationExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => ArangoQueryableExtensions.In(null)) 14 | }; 15 | 16 | public Type CollectionToModify; 17 | 18 | public InModificationExpressionNode(MethodCallExpressionParseInfo parseInfo) 19 | : base(parseInfo) 20 | { 21 | CollectionToModify = parseInfo.ParsedExpression.Type.GenericTypeArguments[0]; 22 | } 23 | 24 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 25 | ClauseGenerationContext clauseGenerationContext) 26 | { 27 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 28 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 29 | 30 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 31 | } 32 | 33 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 34 | ClauseGenerationContext clauseGenerationContext) 35 | { 36 | LinqUtility.CheckNotNull("queryModel", queryModel); 37 | 38 | var modificationClause = queryModel.BodyClauses.NextBodyClause(); 39 | modificationClause.CollectionType = CollectionToModify; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/InsertClause.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using Core.Arango.Relinq; 4 | using Core.Arango.Relinq.Clauses; 5 | 6 | namespace Core.Arango.Linq.Query.Clause 7 | { 8 | internal class InsertClause : IBodyClause, IModificationClause 9 | { 10 | public InsertClause(Expression withSelector, string itemName, Type collectionType) 11 | { 12 | WithSelector = withSelector; 13 | 14 | ItemName = itemName; 15 | 16 | CollectionType = collectionType; 17 | } 18 | 19 | public Expression WithSelector { get; set; } 20 | 21 | public virtual void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index) 22 | { 23 | LinqUtility.CheckNotNull("visitor", visitor); 24 | LinqUtility.CheckNotNull("queryModel", queryModel); 25 | 26 | var arangoVisitor = visitor as ArangoModelVisitor; 27 | 28 | if (arangoVisitor == null) 29 | throw new Exception("QueryModelVisitor should be type of ArangoModelVisitor"); 30 | 31 | arangoVisitor.VisitInsertClause(this, queryModel); 32 | } 33 | 34 | public virtual void TransformExpressions(Func transformation) 35 | { 36 | LinqUtility.CheckNotNull("transformation", transformation); 37 | WithSelector = transformation(WithSelector); 38 | } 39 | 40 | IBodyClause IBodyClause.Clone(CloneContext cloneContext) 41 | { 42 | return Clone(cloneContext); 43 | } 44 | 45 | public string ItemName { get; set; } 46 | 47 | public Type CollectionType { get; set; } 48 | 49 | public bool IgnoreSelect { get; set; } 50 | 51 | public InsertClause Clone(CloneContext cloneContext) 52 | { 53 | LinqUtility.CheckNotNull("cloneContext", cloneContext); 54 | 55 | var result = new InsertClause(WithSelector, ItemName, CollectionType); 56 | return result; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/OptionsClause.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using Core.Arango.Relinq; 4 | using Core.Arango.Relinq.Clauses; 5 | 6 | namespace Core.Arango.Linq.Query.Clause 7 | { 8 | internal class OptionsClause : IBodyClause 9 | { 10 | public OptionsClause(Expression options) 11 | { 12 | Options = options; 13 | } 14 | 15 | public Expression Options { get; set; } 16 | 17 | public virtual void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index) 18 | { 19 | LinqUtility.CheckNotNull("visitor", visitor); 20 | LinqUtility.CheckNotNull("queryModel", queryModel); 21 | 22 | var arangoVisitor = visitor as ArangoModelVisitor; 23 | 24 | if (arangoVisitor == null) 25 | throw new Exception("QueryModelVisitor should be type of ArangoModelVisitor"); 26 | 27 | arangoVisitor.VisitOptionsClause(this, queryModel); 28 | } 29 | 30 | public virtual void TransformExpressions(Func transformation) 31 | { 32 | LinqUtility.CheckNotNull("transformation", transformation); 33 | Options = transformation(Options); 34 | } 35 | 36 | IBodyClause IBodyClause.Clone(CloneContext cloneContext) 37 | { 38 | return Clone(cloneContext); 39 | } 40 | 41 | public OptionsClause Clone(CloneContext cloneContext) 42 | { 43 | LinqUtility.CheckNotNull("cloneContext", cloneContext); 44 | 45 | var result = new OptionsClause(Options); 46 | return result; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/OptionsExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class OptionsExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => ArangoQueryableExtensions.Options(null, () => null)) 14 | }; 15 | 16 | public OptionsExpressionNode(MethodCallExpressionParseInfo parseInfo, Expression options) 17 | : base(parseInfo) 18 | { 19 | Options = options; 20 | } 21 | 22 | public Expression Options { get; } 23 | 24 | 25 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 26 | ClauseGenerationContext clauseGenerationContext) 27 | { 28 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 29 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 30 | 31 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 32 | } 33 | 34 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 35 | ClauseGenerationContext clauseGenerationContext) 36 | { 37 | LinqUtility.CheckNotNull("queryModel", queryModel); 38 | 39 | queryModel.BodyClauses.Add(new OptionsClause( 40 | Options 41 | )); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/RemoveClause.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using Core.Arango.Relinq; 4 | using Core.Arango.Relinq.Clauses; 5 | 6 | namespace Core.Arango.Linq.Query.Clause 7 | { 8 | internal class RemoveClause : IBodyClause, IModificationClause 9 | { 10 | public RemoveClause(string itemName, Type collectionType, Expression keySelector) 11 | { 12 | KeySelector = keySelector; 13 | 14 | ItemName = itemName; 15 | 16 | CollectionType = collectionType; 17 | } 18 | 19 | public Expression KeySelector { get; set; } 20 | 21 | public virtual void Accept(IQueryModelVisitor visitor, QueryModel queryModel, int index) 22 | { 23 | LinqUtility.CheckNotNull("visitor", visitor); 24 | LinqUtility.CheckNotNull("queryModel", queryModel); 25 | 26 | var arangoVisitor = visitor as ArangoModelVisitor; 27 | 28 | if (arangoVisitor == null) 29 | throw new Exception("QueryModelVisitor should be type of ArangoModelVisitor"); 30 | 31 | arangoVisitor.VisitRemoveClause(this, queryModel); 32 | } 33 | 34 | public virtual void TransformExpressions(Func transformation) 35 | { 36 | LinqUtility.CheckNotNull("transformation", transformation); 37 | KeySelector = transformation(KeySelector); 38 | } 39 | 40 | IBodyClause IBodyClause.Clone(CloneContext cloneContext) 41 | { 42 | return Clone(cloneContext); 43 | } 44 | 45 | public string ItemName { get; set; } 46 | 47 | public Type CollectionType { get; set; } 48 | 49 | public bool IgnoreSelect { get; set; } 50 | 51 | public RemoveClause Clone(CloneContext cloneContext) 52 | { 53 | LinqUtility.CheckNotNull("cloneContext", cloneContext); 54 | 55 | var result = new RemoveClause(ItemName, CollectionType, KeySelector); 56 | return result; 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/SelectModificationClause.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Linq.Query.Clause 2 | { 3 | internal class SelectModificationClause 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/SkipExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class SkipExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => Queryable.Skip(null, 0)), 14 | LinqUtility.GetSupportedMethod(() => Enumerable.Skip(null, 0)) 15 | }; 16 | 17 | public SkipExpressionNode(MethodCallExpressionParseInfo parseInfo, Expression count) 18 | : base(parseInfo) 19 | { 20 | Count = count; 21 | } 22 | 23 | public Expression Count { get; } 24 | 25 | 26 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 27 | ClauseGenerationContext clauseGenerationContext) 28 | { 29 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 30 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 31 | 32 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 33 | } 34 | 35 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 36 | ClauseGenerationContext clauseGenerationContext) 37 | { 38 | LinqUtility.CheckNotNull("queryModel", queryModel); 39 | 40 | var lastClause = queryModel.BodyClauses.LastOrDefault(); 41 | var skipTakeClause = lastClause as SkipTakeClause; 42 | if (skipTakeClause != null) 43 | skipTakeClause.SkipCount = Count; 44 | else 45 | queryModel.BodyClauses.Add(new SkipTakeClause(Count, null)); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/TakeExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class TakeExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => Queryable.Take(null, 0)), 14 | LinqUtility.GetSupportedMethod(() => Enumerable.Take(null, 0)) 15 | }; 16 | 17 | public TakeExpressionNode(MethodCallExpressionParseInfo parseInfo, Expression count) 18 | : base(parseInfo) 19 | { 20 | Count = count; 21 | } 22 | 23 | public Expression Count { get; } 24 | 25 | 26 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 27 | ClauseGenerationContext clauseGenerationContext) 28 | { 29 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 30 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 31 | 32 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 33 | } 34 | 35 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 36 | ClauseGenerationContext clauseGenerationContext) 37 | { 38 | LinqUtility.CheckNotNull("queryModel", queryModel); 39 | 40 | var lastClause = queryModel.BodyClauses.LastOrDefault(); 41 | var skipTakeClause = lastClause as SkipTakeClause; 42 | if (skipTakeClause != null) 43 | skipTakeClause.TakeCount = Count; 44 | else 45 | queryModel.BodyClauses.Add(new SkipTakeClause(null, Count)); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/TraversalDepthExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class TraversalDepthExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => ArangoTraversalExtensions.Depth(null, 0, 0)) 14 | }; 15 | 16 | public TraversalDepthExpressionNode(MethodCallExpressionParseInfo parseInfo, 17 | ConstantExpression min, 18 | ConstantExpression max) 19 | : base(parseInfo) 20 | { 21 | Min = min; 22 | Max = max; 23 | } 24 | 25 | public ConstantExpression Min { get; } 26 | 27 | public ConstantExpression Max { get; } 28 | 29 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 30 | ClauseGenerationContext clauseGenerationContext) 31 | { 32 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 33 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 34 | 35 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 36 | } 37 | 38 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 39 | ClauseGenerationContext clauseGenerationContext) 40 | { 41 | LinqUtility.CheckNotNull("queryModel", queryModel); 42 | 43 | var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; 44 | 45 | traversalClause.Min = Min; 46 | traversalClause.Max = Max; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/TraversalGraphNameExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class TraversalGraphNameExpressionNode : MethodCallExpressionNodeBase, IQuerySourceExpressionNode 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => ArangoTraversalExtensions.Graph(null, null)), 14 | LinqUtility.GetSupportedMethod(() => ArangoShortestPathExtensions.Graph(null, null)) 15 | }; 16 | 17 | public TraversalGraphNameExpressionNode(MethodCallExpressionParseInfo parseInfo, ConstantExpression graphName) 18 | : base(parseInfo) 19 | { 20 | GraphName = graphName; 21 | } 22 | 23 | public ConstantExpression GraphName { get; } 24 | 25 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 26 | ClauseGenerationContext clauseGenerationContext) 27 | { 28 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 29 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 30 | 31 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 32 | } 33 | 34 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 35 | ClauseGenerationContext clauseGenerationContext) 36 | { 37 | LinqUtility.CheckNotNull("queryModel", queryModel); 38 | 39 | var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; 40 | 41 | traversalClause.GraphName = GraphName.Value.ToString(); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Clause/TraversalOptionsExpressionNode.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using System.Linq.Expressions; 3 | using System.Reflection; 4 | using Core.Arango.Relinq; 5 | using Core.Arango.Relinq.Parsing.Structure.IntermediateModel; 6 | 7 | namespace Core.Arango.Linq.Query.Clause 8 | { 9 | internal class TraversalOptionsExpressionNode : MethodCallExpressionNodeBase 10 | { 11 | public static readonly MethodInfo[] SupportedMethods = 12 | { 13 | LinqUtility.GetSupportedMethod(() => ArangoTraversalExtensions.Options(null, null)), 14 | LinqUtility.GetSupportedMethod(() => ArangoShortestPathExtensions.Options(null, null)) 15 | }; 16 | 17 | public TraversalOptionsExpressionNode(MethodCallExpressionParseInfo parseInfo, ConstantExpression options) 18 | : base(parseInfo) 19 | { 20 | Options = options; 21 | } 22 | 23 | public ConstantExpression Options { get; } 24 | 25 | public override Expression Resolve(ParameterExpression inputParameter, Expression expressionToBeResolved, 26 | ClauseGenerationContext clauseGenerationContext) 27 | { 28 | LinqUtility.CheckNotNull("inputParameter", inputParameter); 29 | LinqUtility.CheckNotNull("expressionToBeResolved", expressionToBeResolved); 30 | 31 | return Source.Resolve(inputParameter, expressionToBeResolved, clauseGenerationContext); 32 | } 33 | 34 | protected override void ApplyNodeSpecificSemantics(QueryModel queryModel, 35 | ClauseGenerationContext clauseGenerationContext) 36 | { 37 | LinqUtility.CheckNotNull("queryModel", queryModel); 38 | 39 | var traversalClause = queryModel.BodyClauses.Last(b => b is ITraversalClause) as ITraversalClause; 40 | 41 | traversalClause.Options = Options; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/ExtentionIdentifierAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango.Linq.Query 4 | { 5 | internal class ExtentionIdentifierAttribute : Attribute 6 | { 7 | public ExtentionIdentifierAttribute(string identifier) 8 | { 9 | Identifier = identifier; 10 | } 11 | 12 | public string Identifier { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Query/Grouping.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Core.Arango.Linq.Query 6 | { 7 | internal class Grouping : IGrouping 8 | { 9 | public IEnumerable Elements; 10 | 11 | public Grouping(TKey Key) 12 | { 13 | this.Key = Key; 14 | Elements = new List(); 15 | } 16 | 17 | public TKey Key { get; } 18 | 19 | public IEnumerator GetEnumerator() 20 | { 21 | return Elements.GetEnumerator(); 22 | } 23 | 24 | IEnumerator IEnumerable.GetEnumerator() 25 | { 26 | return GetEnumerator(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Core.Arango/Linq/Utility/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Core.Arango.Linq.Collection; 3 | 4 | namespace Core.Arango.Linq.Utility 5 | { 6 | internal class Utils 7 | { 8 | public static T CheckNotNull(string argumentName, T actualValue) 9 | { 10 | if (actualValue == null) 11 | throw new ArgumentNullException(argumentName); 12 | 13 | return actualValue; 14 | } 15 | 16 | public static string EdgeDirectionToString(EdgeDirection direction) 17 | { 18 | switch (direction) 19 | { 20 | case EdgeDirection.Any: 21 | return "any"; 22 | case EdgeDirection.Inbound: 23 | return "inbound"; 24 | case EdgeDirection.Outbound: 25 | return "outbound"; 26 | default: 27 | throw new InvalidOperationException( 28 | $"EdgeDirection {direction} binding not found, this is a client bug"); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoAnalyzerModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// ArangoSearch analyzer 10 | /// 11 | public interface IArangoAnalyzerModule 12 | { 13 | /// 14 | /// creates a new Analyzer based on the provided definition 15 | /// 16 | ValueTask CreateAsync(ArangoHandle database, ArangoAnalyzer analyzer, CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// removes an Analyzer configuration 20 | /// 21 | /// 22 | /// The name of the Analyzer to remove. 23 | /// The Analyzer configuration should be removed even if it is in-use. The default value is false. 24 | /// 25 | ValueTask DeleteAsync(ArangoHandle database, string analyzer, bool force = false, 26 | CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// returns a listing of available Analyzer definitions 30 | /// 31 | ValueTask> ListAsync(ArangoHandle database, 32 | CancellationToken cancellationToken = default); 33 | 34 | /// 35 | /// returns an Analyzer definition 36 | /// 37 | ValueTask GetDefinitionAsync(ArangoHandle database, string analyzer, 38 | CancellationToken cancellationToken = default); 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoBackupModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// HotBackup (enterprise only) 10 | /// 11 | public interface IArangoBackupModule 12 | { 13 | /// 14 | /// Creates a local backup. 15 | /// 16 | ValueTask CreateAsync(ArangoBackupRequest request, CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// Restores from a local backup. 20 | /// 21 | ValueTask RestoreAsync(string id, CancellationToken cancellationToken = default); 22 | 23 | /// 24 | /// Delete a specific local backup. 25 | /// 26 | ValueTask DeleteAsync(string id, CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// List all local backups. 30 | /// 31 | ValueTask> ListAsync(string id = null, CancellationToken cancellationToken = default); 32 | } 33 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoDatabaseModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// Database management 10 | /// 11 | public interface IArangoDatabaseModule 12 | { 13 | /// 14 | /// Creates a new database 15 | /// 16 | ValueTask CreateAsync(ArangoHandle name, CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// Creates a new database with options 20 | /// 21 | ValueTask CreateAsync(ArangoDatabase database, CancellationToken cancellationToken = default); 22 | 23 | /// 24 | /// Retrieves information about the current database 25 | /// 26 | ValueTask GetAsync(ArangoHandle handle, CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// Drop an existing database 30 | /// 31 | ValueTask DropAsync(ArangoHandle name, CancellationToken cancellationToken = default); 32 | 33 | /// 34 | /// Checks if database exists 35 | /// 36 | ValueTask ExistAsync(ArangoHandle name, CancellationToken cancellationToken = default); 37 | 38 | /// 39 | /// Retrieves a list of all existing databases 40 | /// 41 | ValueTask> ListAsync(CancellationToken cancellationToken = default); 42 | } 43 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoFunctionModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// AQL user functions 10 | /// 11 | public interface IArangoFunctionModule 12 | { 13 | /// 14 | /// create a new AQL user function 15 | /// 16 | /// true if newly created 17 | ValueTask CreateAsync(ArangoHandle database, ArangoFunctionDefinition request, 18 | CancellationToken cancellationToken = default); 19 | 20 | /// 21 | /// remove an existing AQL user function 22 | /// 23 | /// 24 | /// the name of the AQL user function 25 | /// 26 | /// The function name provided in name is treated as a namespace prefix, and all functions in the 27 | /// specified namespace will be deleted 28 | /// 29 | /// 30 | /// number of deleted functions 31 | ValueTask RemoveAsync(ArangoHandle database, string name, bool? group = false, 32 | CancellationToken cancellationToken = default); 33 | 34 | /// 35 | /// gets all registered AQL user functions 36 | /// 37 | /// 38 | /// filter user functions from namespace 39 | /// 40 | /// list of function definitions 41 | ValueTask> ListAsync(ArangoHandle database, string ns = null, 42 | CancellationToken cancellationToken = default); 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoIndexModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// Index management 10 | /// 11 | public interface IArangoIndexModule 12 | { 13 | /// 14 | /// creates an index 15 | /// 16 | ValueTask CreateAsync(ArangoHandle database, string collection, ArangoIndex request, 17 | CancellationToken cancellationToken = default); 18 | 19 | /// 20 | /// Drops all indices of a database 21 | /// 22 | ValueTask DropAllAsync(ArangoHandle database, CancellationToken cancellationToken = default); 23 | 24 | /// 25 | /// Drops an index 26 | /// 27 | ValueTask DropAsync(ArangoHandle database, string index, CancellationToken cancellationToken = default); 28 | 29 | /// 30 | /// Returns all indexes of a collection 31 | /// 32 | ValueTask> ListAsync(ArangoHandle database, string collection, 33 | CancellationToken cancellationToken = default); 34 | } 35 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoPregelModule.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Core.Arango.Protocol; 4 | 5 | namespace Core.Arango.Modules 6 | { 7 | /// 8 | /// Arango Pregel Control 9 | /// 10 | public interface IArangoPregelModule 11 | { 12 | /// 13 | /// Start the execution of a Pregel algorithm 14 | /// 15 | ValueTask StartJobAsync(ArangoHandle database, ArangoPregel job, 16 | CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// Get the status of a Pregel execution 20 | /// 21 | ValueTask GetJobStatusAsync(ArangoHandle database, string id, 22 | CancellationToken cancellationToken = default); 23 | 24 | /// 25 | /// Cancel an ongoing Pregel execution 26 | /// 27 | ValueTask DeleteJobAsync(ArangoHandle database, string id, CancellationToken cancellationToken = default); 28 | } 29 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoTransactionModule.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Core.Arango.Protocol; 4 | 5 | namespace Core.Arango.Modules 6 | { 7 | /// 8 | /// Stream and JavaScript transactions 9 | /// 10 | public interface IArangoTransactionModule 11 | { 12 | /// 13 | /// Begin a server-side transaction 14 | /// 15 | ValueTask BeginAsync(ArangoHandle database, ArangoTransaction request, 16 | CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// Abort a server-side transaction 20 | /// 21 | ValueTask AbortAsync(ArangoHandle database, CancellationToken cancellationToken = default); 22 | 23 | /// 24 | /// Commit a server-side transaction 25 | /// 26 | ValueTask CommitAsync(ArangoHandle database, CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// execute a server-side (script) transaction 30 | /// 31 | ValueTask ExecuteAsync(ArangoHandle database, ArangoTransaction request, 32 | CancellationToken cancellationToken = default); 33 | } 34 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/IArangoUserModule.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules 7 | { 8 | /// 9 | /// User management 10 | /// 11 | public interface IArangoUserModule 12 | { 13 | /// 14 | /// Create a new user. 15 | /// 16 | ValueTask CreateAsync(ArangoUser user, CancellationToken cancellationToken = default); 17 | 18 | /// 19 | /// Delete a user permanently. 20 | /// 21 | ValueTask DeleteAsync(string user, CancellationToken cancellationToken = default); 22 | 23 | 24 | /// 25 | /// Clear the database access level, revert back to the default access level 26 | /// 27 | ValueTask DeleteDatabaseAccessAsync(ArangoHandle handle, string user, 28 | CancellationToken cancellationToken = default); 29 | 30 | /// 31 | /// Lists all users 32 | /// 33 | ValueTask> ListAsync(CancellationToken cancellationToken = default); 34 | 35 | /// 36 | /// Modify attributes of an existing user 37 | /// 38 | ValueTask PatchAsync(ArangoUser user, CancellationToken cancellationToken = default); 39 | 40 | /// 41 | /// Set the database access level. 42 | /// 43 | ValueTask SetDatabaseAccessAsync(ArangoHandle handle, string user, ArangoAccess access, 44 | CancellationToken cancellationToken = default); 45 | } 46 | } -------------------------------------------------------------------------------- /Core.Arango/Modules/Internal/ArangoPregelModule.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Http; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Core.Arango.Protocol; 5 | 6 | namespace Core.Arango.Modules.Internal 7 | { 8 | internal class ArangoPregelModule : ArangoModule, IArangoPregelModule 9 | { 10 | internal ArangoPregelModule(IArangoContext context) : base(context) 11 | { 12 | } 13 | 14 | public async ValueTask StartJobAsync(ArangoHandle database, ArangoPregel job, 15 | CancellationToken cancellationToken = default) 16 | { 17 | return await SendAsync(database, HttpMethod.Post, 18 | ApiPath(database, "control_pregel"), 19 | job, cancellationToken: cancellationToken).ConfigureAwait(false); 20 | } 21 | 22 | public async ValueTask GetJobStatusAsync(ArangoHandle database, string id, 23 | CancellationToken cancellationToken = default) 24 | { 25 | return await SendAsync(database, HttpMethod.Get, 26 | ApiPath(database, $"control_pregel/{id}"), 27 | cancellationToken: cancellationToken).ConfigureAwait(false); 28 | } 29 | 30 | public async ValueTask DeleteJobAsync(ArangoHandle database, string id, 31 | CancellationToken cancellationToken = default) 32 | { 33 | await SendAsync(database, HttpMethod.Delete, 34 | ApiPath(database, $"control_pregel/{id}"), 35 | cancellationToken: cancellationToken).ConfigureAwait(false); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/PolyfillHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Http; 5 | 6 | namespace Core.Arango 7 | { 8 | /// 9 | /// Helper class to group all code that is used to facilitate backwards compatibility for dotnet Standard v2.0 10 | /// 11 | internal static class PolyfillHelper 12 | { 13 | /// 14 | /// For compatibility with netstandard 2.0 which does not have a HttpMethod.Patch method 15 | /// 16 | internal static HttpMethod Patch 17 | { 18 | get 19 | { 20 | #if NETSTANDARD2_0 21 | return new HttpMethod("Patch"); 22 | #else 23 | return HttpMethod.Patch; 24 | #endif 25 | } 26 | } 27 | 28 | /// 29 | /// Alternative implementation of Split(seperator, StringSplitOptions.RemoveEmptyEntries) which is not available in netstandard2.0 30 | /// 31 | internal static IEnumerable SplitAndRemoveEmptyEntries(this string endpoints, params char[] separator) 32 | { 33 | #if NETSTANDARD2_0 34 | return endpoints?.Split(separator).Where(s => !string.IsNullOrEmpty(s)); 35 | #else 36 | return endpoints?.Split(',', StringSplitOptions.RemoveEmptyEntries); 37 | #endif 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoAnalyzer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// ArangoSearch Analyzer 9 | /// 10 | public class ArangoAnalyzer 11 | { 12 | /// 13 | /// The Analyzer name. 14 | /// 15 | [JsonPropertyName("name")] 16 | [JsonProperty(PropertyName = "name")] 17 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 18 | public string Name { get; set; } 19 | 20 | 21 | /// 22 | /// The Analyzer type. 23 | /// 24 | /// 25 | /// 26 | [JsonPropertyName("type")] 27 | [JsonProperty(PropertyName = "type")] 28 | public ArangoAnalyzerType Type { get; set; } 29 | 30 | /// 31 | /// The properties used to configure the specified Analyzer type. 32 | /// 33 | [JsonPropertyName("properties")] 34 | [JsonProperty(PropertyName = "properties")] 35 | public ArangoAnalyzerProperties Properties { get; set; } 36 | 37 | /// 38 | /// The set of features to set on the Analyzer generated fields. The default value is an empty array. 39 | /// 40 | [JsonPropertyName("features")] 41 | [JsonProperty(PropertyName = "features")] 42 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 43 | public List Features { get; set; } 44 | 45 | /// 46 | /// Overflow properties 47 | /// 48 | [Newtonsoft.Json.JsonExtensionData] 49 | [System.Text.Json.Serialization.JsonExtensionData] 50 | public Dictionary ExtensionData { get; set; } 51 | } 52 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoAnalyzerBreakType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// ArangoGeoJsonType 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoAnalyzerBreakType 14 | { 15 | /// 16 | /// return all tokens 17 | /// 18 | [EnumMember(Value = "all")] All, 19 | 20 | /// 21 | /// return tokens composed of alphanumeric characters only (default) 22 | /// 23 | [EnumMember(Value = "alpha")] Alpha, 24 | 25 | /// 26 | /// return tokens composed of non-whitespace characters only. Note that the list of whitespace characters does not include line breaks: 27 | /// 28 | [EnumMember(Value = "graphic")] Graphic 29 | } 30 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoAnalyzerCase.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// AnalyzerType 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoAnalyzerCase 14 | { 15 | /// 16 | /// To convert to all lower-case characters (default) 17 | /// 18 | [EnumMember(Value = "lower")] Lower, 19 | 20 | /// 21 | /// To convert to all upper-case characters 22 | /// 23 | [EnumMember(Value = "upper")] Upper, 24 | 25 | /// 26 | /// To not change character case 27 | /// 28 | [EnumMember(Value = "none")] None 29 | } 30 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoAnalyzerGeoJsonType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// ArangoGeoJsonType 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoAnalyzerGeoJsonType 14 | { 15 | /// 16 | /// index all GeoJSON geometry types (Point, Polygon etc.) 17 | /// 18 | [EnumMember(Value = "shape")] Shape, 19 | 20 | /// 21 | /// compute and only index the centroid of the input geometry 22 | /// 23 | [EnumMember(Value = "centroid")] Centroid, 24 | 25 | /// 26 | /// only index GeoJSON objects of type Point, ignore all other geometry types 27 | /// 28 | [EnumMember(Value = "point")] Point 29 | } 30 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoAstNode.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// 9 | /// 10 | public class ArangoAstNode 11 | { 12 | /// 13 | /// 14 | /// 15 | [JsonPropertyName("type")] 16 | [JsonProperty(PropertyName = "type")] 17 | public string Type { get; set; } 18 | 19 | /// 20 | /// 21 | /// 22 | [JsonPropertyName("subNodes")] 23 | [JsonProperty(PropertyName = "subNodes")] 24 | public ICollection SubNodes { get; set; } 25 | 26 | /// 27 | /// 28 | /// 29 | [JsonPropertyName("name")] 30 | [JsonProperty(PropertyName = "name")] 31 | public string Name { get; set; } 32 | 33 | /// 34 | /// 35 | /// 36 | [JsonPropertyName("id")] 37 | [JsonProperty(PropertyName = "id")] 38 | public long Id { get; set; } 39 | 40 | /// 41 | /// 42 | /// 43 | [JsonPropertyName("value")] 44 | [JsonProperty(PropertyName = "value")] 45 | public object Value { get; set; } 46 | } 47 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoCollectionType.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Protocol 2 | { 3 | /// 4 | /// Arango collection type 5 | /// 6 | public enum ArangoCollectionType 7 | { 8 | /// 9 | /// document collection 10 | /// 11 | Document = 2, 12 | 13 | /// 14 | /// edge collection 15 | /// 16 | Edge = 3 17 | } 18 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoComputeOn.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// 10 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 11 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 12 | public enum ArangoComputeOn 13 | { 14 | /// 15 | /// Insert 16 | /// 17 | [EnumMember(Value = "insert")] Insert, 18 | 19 | /// 20 | /// Update 21 | /// 22 | [EnumMember(Value = "update")] Update, 23 | 24 | /// 25 | /// Replace 26 | /// 27 | [EnumMember(Value = "replace")] Replace 28 | } 29 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoDatabase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// Arango Database 9 | /// 10 | public class ArangoDatabase 11 | { 12 | /// 13 | /// Has to contain a valid database name. 14 | /// 15 | [JsonPropertyName("name")] 16 | [JsonProperty(PropertyName = "name")] 17 | public string Name { get; set; } 18 | 19 | /// 20 | /// Database Options 21 | /// 22 | [JsonPropertyName("options")] 23 | [JsonProperty(PropertyName = "options")] 24 | public ArangoDatabaseOptions Options { get; set; } 25 | 26 | /// 27 | /// Has to be an array of user objects to initially create for the new database. User information will not be changed for users that already exist. If users is not specified or does not contain any users, a default user root will be created with an empty string password. This ensures that the new database will be accessible after it is created. 28 | /// 29 | [JsonPropertyName("users")] 30 | [JsonProperty(PropertyName = "users")] 31 | public ICollection Users { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoDatabaseOptions.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango Database Options 8 | /// 9 | public class ArangoDatabaseOptions 10 | { 11 | /// 12 | /// The sharding method to use for new collections in this database. 13 | /// Valid values are: “”, “flexible”, or “single”. 14 | /// The first two are equivalent. (cluster only) 15 | /// 16 | [JsonPropertyName("name")] 17 | [JsonProperty(PropertyName = "name")] 18 | public string Sharding { get; set; } 19 | 20 | /// 21 | /// Default replication factor for new collections created in this database. 22 | /// Special values include “satellite”, which will replicate the collection to every DB-Server (Enterprise Edition only), and 1, which disables replication. (cluster only) 23 | /// 24 | [JsonPropertyName("replicationFactor")] 25 | [JsonProperty(PropertyName = "replicationFactor")] 26 | public object ReplicationFactor { get; set; } 27 | 28 | 29 | /// 30 | /// Default write concern for new collections created in this database. 31 | /// It determines how many copies of each shard are required to be in sync on the different DB-Servers. 32 | /// If there are less then these many copies in the cluster a shard will refuse to write. 33 | /// Writes to shards with enough up-to-date copies will succeed at the same time however. 34 | /// The value of writeConcern can not be larger than replicationFactor. (cluster only) 35 | /// 36 | [JsonPropertyName("writeConcern")] 37 | [JsonProperty(PropertyName = "writeConcern")] 38 | public int? WriteConcern { get; set; } 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoEdgeDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// Edge definition 9 | /// 10 | public class ArangoEdgeDefinition 11 | { 12 | /// 13 | /// The name of the edge collection to be used. 14 | /// 15 | [JsonPropertyName("collection")] 16 | [JsonProperty(PropertyName = "collection")] 17 | public string Collection { get; set; } 18 | 19 | /// 20 | /// One or many vertex collections that can contain source vertices. 21 | /// 22 | [JsonPropertyName("from")] 23 | [JsonProperty(PropertyName = "from")] 24 | public List From { get; set; } 25 | 26 | /// 27 | /// One or many vertex collections that can contain target vertices. 28 | /// 29 | [JsonPropertyName("to")] 30 | [JsonProperty(PropertyName = "to")] 31 | public List To { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoEdgeResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango Graph Edge Response 8 | /// 9 | public class ArangoEdgeResponse : ArangoResponseBase 10 | { 11 | /// 12 | /// Edge 13 | /// 14 | [JsonPropertyName("edge")] 15 | [JsonProperty(PropertyName = "edge")] 16 | public T Edge { get; set; } 17 | 18 | /// 19 | /// New version 20 | /// 21 | [JsonPropertyName("new")] 22 | [JsonProperty(PropertyName = "new")] 23 | public T New { get; set; } 24 | 25 | /// 26 | /// Old version 27 | /// 28 | [JsonPropertyName("old")] 29 | [JsonProperty(PropertyName = "old")] 30 | public T Old { get; set; } 31 | 32 | /// 33 | /// When Removed 34 | /// 35 | [JsonPropertyName("removed")] 36 | [JsonProperty(PropertyName = "removed")] 37 | public bool Removed { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoError.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Protocol 2 | { 3 | /// 4 | /// Arango Error Description 5 | /// 6 | public class ArangoError 7 | { 8 | // 9 | /// Arango Error Description 10 | /// message 11 | /// code 12 | public ArangoError(string errorMessage, ArangoErrorCode errorNumber) 13 | { 14 | ErrorMessage = errorMessage; 15 | ErrorNumber = errorNumber; 16 | } 17 | 18 | /// 19 | /// Message 20 | /// 21 | public string ErrorMessage { get; } 22 | 23 | /// 24 | /// Code 25 | /// 26 | public ArangoErrorCode? ErrorNumber { get; } 27 | } 28 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoExplainResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// 9 | /// 10 | public class ArangoExplainResult : ArangoResponseBase 11 | { 12 | /// 13 | /// 14 | /// 15 | [JsonPropertyName("plan")] 16 | [JsonProperty(PropertyName = "plan")] 17 | public Dictionary Plan { get; set; } 18 | 19 | /// 20 | /// 21 | /// 22 | [JsonPropertyName("allPlans")] 23 | [JsonProperty(PropertyName = "allPlans")] 24 | public ICollection> AllPlans { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoFoxxService.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Foxx Service Description 8 | /// 9 | public class ArangoFoxxService 10 | { 11 | /// 12 | /// the mount path of the service 13 | /// 14 | [JsonPropertyName("mount")] 15 | [JsonProperty(PropertyName = "mount")] 16 | public string Mount { get; set; } 17 | 18 | /// 19 | /// true if the service is running in development mode 20 | /// 21 | [JsonPropertyName("development")] 22 | [JsonProperty(PropertyName = "development")] 23 | public bool Development { get; set; } 24 | 25 | /// 26 | /// true if the service is running in 2.8 legacy compatibility mode 27 | /// 28 | [JsonPropertyName("legacy")] 29 | [JsonProperty(PropertyName = "legacy")] 30 | public bool Legacy { get; set; } 31 | 32 | /// 33 | /// a string identifying the service type 34 | /// 35 | [JsonPropertyName("name")] 36 | [JsonProperty(PropertyName = "name")] 37 | public string Name { get; set; } 38 | 39 | /// 40 | /// a semver-compatible version string 41 | /// 42 | [JsonPropertyName("version")] 43 | [JsonProperty(PropertyName = "version")] 44 | public string Version { get; set; } 45 | } 46 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoFoxxSource.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace Core.Arango.Protocol 4 | { 5 | /// 6 | /// Foxx service installation source 7 | /// 8 | public class ArangoFoxxSource 9 | { 10 | private ArangoFoxxSource() 11 | { 12 | } 13 | 14 | internal string Url { get; private set; } 15 | internal string JavaScript { get; private set; } 16 | internal Stream ZipArchive { get; private set; } 17 | 18 | // TODO: Broken? 19 | // public static ArangoFoxxSource FromUrl(string url) => new ArangoFoxxSource {Url = url}; 20 | 21 | /// 22 | /// Foxx service from zip archive 23 | /// 24 | public static ArangoFoxxSource FromZip(Stream zip) 25 | { 26 | return new() {ZipArchive = zip}; 27 | } 28 | 29 | /// 30 | /// Foxx service from single javascript file 31 | /// 32 | public static ArangoFoxxSource FromJavaScript(string script) 33 | { 34 | return new() {JavaScript = script}; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoFunctionDefinition.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango User Functions 8 | /// 9 | public class ArangoFunctionDefinition 10 | { 11 | /// 12 | /// The fully qualified name of the user functions. 13 | /// 14 | [JsonPropertyName("name")] 15 | [JsonProperty(PropertyName = "name", Required = Required.Always)] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// A string representation of the function body. 20 | /// 21 | [JsonPropertyName("code")] 22 | [JsonProperty(PropertyName = "code", Required = Required.Always)] 23 | public string Code { get; set; } 24 | 25 | /// 26 | /// An optional boolean value to indicate whether the function results are fully deterministic (function return value 27 | /// solely depends on the input value and return value is the same for repeated calls with same input). 28 | /// The isDeterministic attribute is currently not used but may be used later for optimizations. 29 | /// 30 | [JsonPropertyName("isDeterministic")] 31 | [JsonProperty(PropertyName = "isDeterministic", DefaultValueHandling = DefaultValueHandling.Ignore)] 32 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] 33 | public bool IsDeterministic { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoKeyType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// Arango key generation type 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoKeyType 14 | { 15 | /// 16 | /// The traditional key generator generates numerical keys in ascending order. 17 | /// 18 | [EnumMember(Value = "traditional")] Traditional, 19 | 20 | /// 21 | /// The autoincrement key generator generates numerical keys in ascending order, the initial offset and the spacing can 22 | /// be configured 23 | /// 24 | [EnumMember(Value = "autoincrement")] Autoincrement, 25 | 26 | /// 27 | /// The uuid key generator generates universally unique 128 bit keys, which are stored in hexadecimal human-readable 28 | /// format. 29 | /// This key generator can be used in a single-server or cluster to generate “seemingly random” keys. 30 | /// The keys produced by this key generator are not lexicographically sorted. 31 | /// 32 | [EnumMember(Value = "uuid")] Uuid, 33 | 34 | /// 35 | /// The padded key generator generates keys of a fixed length (16 bytes) in ascending lexicographical sort order. 36 | /// This is ideal for usage with the RocksDB engine, which will slightly benefit keys that are inserted in 37 | /// lexicographically ascending order. 38 | /// The key generator can be used in a single-server or cluster 39 | /// 40 | [EnumMember(Value = "padded")] Padded 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoNgramStreamType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// N-gram stream type 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoNgramStreamType 14 | { 15 | /// 16 | /// One byte is considered as one character (default) 17 | /// 18 | [EnumMember(Value = "binary")] Binary, 19 | 20 | /// 21 | /// one Unicode codepoint is treated as one character 22 | /// 23 | [EnumMember(Value = "upper")] Utf8 24 | } 25 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoParseResult.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// 9 | /// 10 | public class ArangoParseResult : ArangoResponseBase 11 | { 12 | /// 13 | /// 14 | /// 15 | [JsonPropertyName("parsed")] 16 | [JsonProperty(PropertyName = "parsed")] 17 | public bool Parsed { get; set; } 18 | 19 | /// 20 | /// Abstract Syntax Tree 21 | /// 22 | [JsonPropertyName("ast")] 23 | [JsonProperty(PropertyName = "ast")] 24 | public ICollection Ast { get; set; } 25 | } 26 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoPregel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// Pregel Job 9 | /// 10 | public class ArangoPregel 11 | { 12 | /// 13 | /// Name of the algorithm 14 | /// 15 | [JsonPropertyName("algorithm")] 16 | [JsonProperty(PropertyName = "algorithm")] 17 | public string Algorithm { get; set; } 18 | 19 | /// 20 | /// Name of a graph. Either this or the parameters vertexCollections and edgeCollections are required. Please note that 21 | /// there are special sharding requirements for graphs in order to be used with Pregel. 22 | /// 23 | [JsonPropertyName("graphName")] 24 | [JsonProperty(PropertyName = "graphName")] 25 | public string GraphName { get; set; } 26 | 27 | /// 28 | /// List of vertex collection names. Please note that there are special sharding requirements for collections in order 29 | /// to be used with Pregel. 30 | /// 31 | [JsonPropertyName("vertexCollections")] 32 | [JsonProperty(PropertyName = "vertexCollections")] 33 | public ICollection VertexCollections { get; set; } 34 | 35 | /// 36 | /// List of edge collection names. Please note that there are special sharding requirements for collections in order to 37 | /// be used with Pregel. 38 | /// 39 | [JsonPropertyName("edgeCollections")] 40 | [JsonProperty(PropertyName = "edgeCollections")] 41 | public ICollection EdgeCollections { get; set; } 42 | 43 | /// 44 | /// General as well as algorithm-specific options. 45 | /// 46 | [JsonPropertyName("params")] 47 | [JsonProperty(PropertyName = "params")] 48 | public IDictionary Params { get; set; } 49 | } 50 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoResponseBase.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Base response model 8 | /// 9 | public abstract class ArangoResponseBase 10 | { 11 | /// 12 | /// HTTP Status Code 13 | /// 14 | [JsonPropertyName("code")] 15 | [JsonProperty(PropertyName = "code")] 16 | public short Code { get; set; } 17 | 18 | /// 19 | /// Has Error? 20 | /// 21 | [JsonPropertyName("error")] 22 | [JsonProperty(PropertyName = "error")] 23 | public bool Error { get; set; } 24 | 25 | /// 26 | /// Error Message 27 | /// 28 | [JsonPropertyName("errorMessage")] 29 | [JsonProperty(PropertyName = "errorMessage")] 30 | public string ErrorMessage { get; set; } 31 | 32 | /// 33 | /// Error Code 34 | /// 35 | [JsonPropertyName("errorNum")] 36 | [JsonProperty(PropertyName = "errorNum")] 37 | public int ErrorNum { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoSchema.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Schema Validation 8 | /// 9 | public class ArangoSchema 10 | { 11 | /// 12 | /// The rule attribute must contain the JSON Schema description. 13 | /// 14 | /// 15 | /// { 16 | /// properties: { nums: { type: "array", items: { type: "number", maximum: 6 } } }, 17 | /// additionalProperties: { type: "string" }, 18 | /// required: ["nums"] 19 | /// } 20 | /// 21 | [JsonPropertyName("rule")] 22 | [JsonProperty(PropertyName = "rule")] 23 | public object Rule { get; set; } 24 | 25 | /// 26 | /// controls when the validation will be applied. 27 | /// 28 | [JsonPropertyName("level")] 29 | [JsonProperty(PropertyName = "level")] 30 | public ArangoSchemaLevel Level { get; set; } = ArangoSchemaLevel.Strict; 31 | 32 | /// 33 | /// sets the message that will be used when validation fails. 34 | /// 35 | [JsonPropertyName("message")] 36 | [JsonProperty(PropertyName = "message")] 37 | public string Message { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoSchemaLevel.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// Arango schema validation level 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoSchemaLevel 14 | { 15 | /// 16 | /// The rule is inactive and validation thus turned off. 17 | /// 18 | [EnumMember(Value = "none")] None, 19 | 20 | /// 21 | /// Only newly inserted documents are validated. 22 | /// 23 | [EnumMember(Value = "new")] New, 24 | 25 | /// 26 | /// New and modified documents must pass validation, except for modified documents where the OLD value did not pass 27 | /// validation already. 28 | /// This level is useful if you have documents which do not match your target structure, but you want to stop the 29 | /// insertion of more invalid documents and prohibit that valid documents are changed to invalid documents. 30 | /// 31 | [EnumMember(Value = "moderate")] Moderate, 32 | 33 | /// 34 | /// All new and modified document must strictly pass validation. No exceptions are made (default). 35 | /// 36 | [EnumMember(Value = "strict")] Strict 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoSort.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// ArangoView Sort description 9 | /// 10 | public class ArangoSort 11 | { 12 | /// 13 | /// Attribute to sort by 14 | /// 15 | [JsonPropertyName("field")] 16 | [JsonProperty(PropertyName = "field")] 17 | public string Field { get; set; } 18 | 19 | /// 20 | /// Sort direction 21 | /// 22 | [JsonPropertyName("direction")] 23 | [JsonProperty(PropertyName = "direction")] 24 | public ArangoSortDirection Direction { get; set; } 25 | 26 | /// 27 | /// Overflow properties 28 | /// 29 | [Newtonsoft.Json.JsonExtensionData] 30 | [System.Text.Json.Serialization.JsonExtensionData] 31 | public Dictionary ExtensionData { get; set; } 32 | } 33 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoTransactionScope.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// Arango Transaction Scope 9 | /// 10 | public class ArangoTransactionScope 11 | { 12 | /// 13 | /// Collections to read from 14 | /// 15 | [JsonPropertyName("read")] 16 | [JsonProperty(PropertyName = "read", NullValueHandling = NullValueHandling.Ignore)] 17 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 18 | public List Read { get; set; } 19 | 20 | /// 21 | /// Collections to write to 22 | /// 23 | [JsonPropertyName("write")] 24 | [JsonProperty(PropertyName = "write", NullValueHandling = NullValueHandling.Ignore)] 25 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 26 | public List Write { get; set; } 27 | 28 | 29 | /// 30 | /// Collections to write to with an exclusive lock 31 | /// 32 | [JsonPropertyName("exclusive")] 33 | [JsonProperty(PropertyName = "exclusive", NullValueHandling = NullValueHandling.Ignore)] 34 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 35 | public List Exclusive { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoUpdateResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango document update result 8 | /// 9 | /// 10 | public class ArangoUpdateResult 11 | { 12 | /// 13 | /// Id 14 | /// 15 | [JsonPropertyName("_id")] 16 | [JsonProperty(PropertyName = "_id")] 17 | public string Id { get; set; } 18 | 19 | /// 20 | /// Key 21 | /// 22 | [JsonPropertyName("_key")] 23 | [JsonProperty(PropertyName = "_key")] 24 | public string Key { get; set; } 25 | 26 | /// 27 | /// Revision 28 | /// 29 | [JsonPropertyName("_rev")] 30 | [JsonProperty(PropertyName = "_rev")] 31 | public string Revision { get; set; } 32 | 33 | /// 34 | /// Old Revision 35 | /// 36 | [JsonPropertyName("_oldRev")] 37 | [JsonProperty(PropertyName = "_oldRev")] 38 | public string OldRevision { get; set; } 39 | 40 | /// 41 | /// Old document 42 | /// 43 | [JsonPropertyName("old")] 44 | [JsonProperty(PropertyName = "old")] 45 | public T Old { get; set; } 46 | 47 | /// 48 | /// New document 49 | /// 50 | [JsonPropertyName("new")] 51 | [JsonProperty(PropertyName = "new")] 52 | public T New { get; set; } 53 | } 54 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoUser.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango User 8 | /// 9 | public class ArangoUser 10 | { 11 | /// 12 | /// The name of the user as a string. This is mandatory. 13 | /// 14 | [JsonPropertyName("user")] 15 | [JsonProperty(PropertyName = "user")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// The user password as a string. If no password is specified, the empty string will be used. 20 | /// 21 | [JsonPropertyName("passwd")] 22 | [JsonProperty(PropertyName = "passwd")] 23 | public string Password { get; set; } 24 | 25 | /// 26 | /// An optional flag that specifies whether the user is active. If not specified, this will default to true 27 | /// 28 | [JsonPropertyName("active")] 29 | [JsonProperty(PropertyName = "active", DefaultValueHandling = DefaultValueHandling.Ignore)] 30 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 31 | public bool? Active { get; set; } 32 | 33 | /// 34 | /// An optional JSON object with arbitrary extra data about the user. 35 | /// 36 | [JsonPropertyName("extra")] 37 | [JsonProperty(PropertyName = "extra", DefaultValueHandling = DefaultValueHandling.Ignore)] 38 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 39 | public object Extra { get; set; } 40 | } 41 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoVersion.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// Arango Server Version and License Information 9 | /// 10 | public class ArangoVersion 11 | { 12 | /// 13 | /// Raw version string 14 | /// 15 | [JsonPropertyName("version")] 16 | [JsonProperty("version")] 17 | public string Version { get; set; } 18 | 19 | /// 20 | /// license string 21 | /// 22 | [JsonPropertyName("license")] 23 | [JsonProperty("license")] 24 | public string License { get; set; } 25 | 26 | /// 27 | /// Parsed (comparable) version 28 | /// 29 | public Version SemanticVersion { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoVertexCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango Vertex Collection 8 | /// 9 | public class ArangoVertexCollection 10 | { 11 | /// 12 | /// Collection name 13 | /// 14 | [JsonPropertyName("collection")] 15 | [JsonProperty(PropertyName = "collection")] 16 | public string Collection { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoVertexResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango Graph Vertex Response 8 | /// 9 | public class ArangoVertexResponse : ArangoResponseBase 10 | { 11 | /// 12 | /// Vertex 13 | /// 14 | [JsonPropertyName("vertex")] 15 | [JsonProperty(PropertyName = "vertex")] 16 | public T Vertex { get; set; } 17 | 18 | /// 19 | /// New version 20 | /// 21 | [JsonPropertyName("new")] 22 | [JsonProperty(PropertyName = "new")] 23 | public T New { get; set; } 24 | 25 | /// 26 | /// Old version 27 | /// 28 | [JsonPropertyName("old")] 29 | [JsonProperty(PropertyName = "old")] 30 | public T Old { get; set; } 31 | 32 | /// 33 | /// When Removed 34 | /// 35 | [JsonPropertyName("removed")] 36 | [JsonProperty(PropertyName = "removed")] 37 | public bool Removed { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoViewCompressionType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// Arango View Compression 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoViewCompressionType 14 | { 15 | /// 16 | /// LZ4 17 | /// 18 | [EnumMember(Value = "lz4")] Lz4, 19 | 20 | /// 21 | /// None 22 | /// 23 | [EnumMember(Value = "none")] None 24 | } 25 | 26 | /// 27 | /// Arango View Compression 28 | /// 29 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 30 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 31 | public enum ArangoSortDirection 32 | { 33 | /// 34 | /// Ascending 35 | /// 36 | [EnumMember(Value = "asc")] Asc, 37 | 38 | /// 39 | /// Descending 40 | /// 41 | [EnumMember(Value = "desc")] Desc 42 | } 43 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoViewConsolidationType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | using System.Text.Json.Serialization; 3 | using Core.Arango.Serialization.Json; 4 | using Newtonsoft.Json.Converters; 5 | 6 | namespace Core.Arango.Protocol 7 | { 8 | /// 9 | /// Arango View Consolidation Type 10 | /// 11 | [JsonConverter(typeof(JsonStringEnumMemberConverter))] 12 | [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] 13 | public enum ArangoViewConsolidationType 14 | { 15 | /// 16 | /// (default): consolidate based on segment byte size and live document count as dictated by the customization 17 | /// attributes. 18 | /// If this type is used, then below segments* and minScore properties are available. 19 | /// 20 | [EnumMember(Value = "tier")] Tier, 21 | 22 | /// 23 | /// Consolidate if and only if {threshold} > (segment_bytes + sum_of_merge_candidate_segment_bytes) / all_segment_bytes 24 | /// i.e. the sum of all candidate segment byte size is less than the total segment byte size multiplied by the 25 | /// {threshold}. 26 | /// If this type is used, then below threshold property is available. 27 | /// 28 | [EnumMember(Value = "bytes_accum")] BytesAccum 29 | } 30 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoViewInformation.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol 5 | { 6 | /// 7 | /// Arango View Information 8 | /// 9 | public class ArangoViewInformation 10 | { 11 | /// 12 | /// The name of the View. 13 | /// 14 | [JsonPropertyName("name")] 15 | [JsonProperty(PropertyName = "name")] 16 | public string Name { get; set; } 17 | 18 | /// 19 | /// 20 | /// 21 | [JsonPropertyName("globallyUniqueId")] 22 | [JsonProperty(PropertyName = "globallyUniqueId")] 23 | public string GloballyUniqueId { get; set; } 24 | 25 | /// 26 | /// 27 | /// 28 | [JsonPropertyName("id")] 29 | [JsonProperty(PropertyName = "id")] 30 | public string Id{ get; set; } 31 | 32 | /// 33 | /// 34 | /// 35 | [JsonPropertyName("type")] 36 | [JsonProperty(PropertyName = "type")] 37 | public string Type { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoViewStoredValue.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol 6 | { 7 | /// 8 | /// 9 | public class ArangoViewStoredValue 10 | { 11 | /// 12 | /// Attribute paths to store 13 | /// 14 | [JsonPropertyName("fields")] 15 | [JsonProperty(PropertyName = "fields")] 16 | public List Fields { get; set; } 17 | 18 | /// 19 | /// Compression 20 | /// 21 | [JsonPropertyName("compression")] 22 | [JsonProperty(PropertyName = "compression")] 23 | public ArangoViewCompressionType Compression { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/ArangoVoid.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Protocol 2 | { 3 | /// 4 | /// Something to deserialize to when no response needed 5 | /// 6 | public class ArangoVoid 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/BackupList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol.Internal 6 | { 7 | internal class BackupList 8 | { 9 | [JsonPropertyName("server")] 10 | [JsonProperty(PropertyName = "server")] 11 | public string Server { get; set; } 12 | 13 | [JsonPropertyName("list")] 14 | [JsonProperty(PropertyName = "list")] 15 | public SortedDictionary List { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/DocumentCreateResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class DocumentCreateResponse 7 | { 8 | [JsonPropertyName("_id")] 9 | [JsonProperty(PropertyName = "_id")] 10 | public string Id { get; set; } 11 | 12 | [JsonPropertyName("_key")] 13 | [JsonProperty(PropertyName = "_key")] 14 | public string Key { get; set; } 15 | 16 | 17 | [JsonPropertyName("_rev")] 18 | [JsonProperty(PropertyName = "_rev")] 19 | public string Revision { get; set; } 20 | 21 | [JsonPropertyName("new")] 22 | [JsonProperty(PropertyName = "new")] 23 | public T New { get; set; } 24 | 25 | [JsonPropertyName("old")] 26 | [JsonProperty(PropertyName = "old")] 27 | public T Old { get; set; } 28 | 29 | [JsonPropertyName("error")] 30 | [JsonProperty(PropertyName = "error")] 31 | public bool Error { get; set; } 32 | 33 | [JsonPropertyName("errorMessage")] 34 | [JsonProperty(PropertyName = "errorMessage")] 35 | public string ErrorMessage { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/EndpointEntity.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class EndpointEntity 7 | { 8 | [JsonPropertyName("endpoint")] 9 | [JsonProperty("endpoint")] 10 | public string Endpoint { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/EndpointResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol.Internal 6 | { 7 | internal class EndpointResponse 8 | { 9 | [JsonPropertyName("endpoints")] 10 | [JsonProperty("endpoints")] 11 | public List Endpoints { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/ErrorResponse.cs: -------------------------------------------------------------------------------- 1 | namespace Core.Arango.Protocol.Internal 2 | { 3 | internal class ErrorResponse : ArangoResponseBase 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/ExportRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class ExportRequest 7 | { 8 | [JsonPropertyName("flush")] 9 | [JsonProperty(PropertyName = "flush", NullValueHandling = NullValueHandling.Ignore)] 10 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 11 | public bool? Flush { get; set; } 12 | 13 | [JsonPropertyName("flushWait")] 14 | [JsonProperty(PropertyName = "flushWait", NullValueHandling = NullValueHandling.Ignore)] 15 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 16 | public int? FlushWait { get; set; } 17 | 18 | [JsonPropertyName("batchSize")] 19 | [JsonProperty(PropertyName = "batchSize", NullValueHandling = NullValueHandling.Ignore)] 20 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 21 | public int? BatchSize { get; set; } 22 | 23 | [JsonPropertyName("ttl")] 24 | [JsonProperty(PropertyName = "ttl", NullValueHandling = NullValueHandling.Ignore)] 25 | [System.Text.Json.Serialization.JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] 26 | public int? Ttl { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/FunctionCreateResponse.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Core.Arango.Protocol.Internal 4 | { 5 | internal class FunctionCreateResponse : ArangoResponseBase 6 | { 7 | [JsonProperty(PropertyName = "isNewlyCreated")] 8 | public bool IsNewlyCreated { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/FunctionRemoveResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class FunctionRemoveResponse : ArangoResponseBase 7 | { 8 | [JsonPropertyName("deletedCount")] 9 | [JsonProperty(PropertyName = "deletedCount")] 10 | public int DeletedCount { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/GraphResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol.Internal 6 | { 7 | internal class GraphsResponse 8 | { 9 | [JsonPropertyName("graphs")] 10 | [JsonProperty(PropertyName = "graphs")] 11 | public List Graphs { get; set; } 12 | } 13 | 14 | internal class GraphResponse 15 | { 16 | [JsonPropertyName("graph")] 17 | [JsonProperty(PropertyName = "graph")] 18 | public T Graph { get; set; } 19 | } 20 | 21 | 22 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/QueryResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class QueryResponse : QueryResponseBase 7 | { 8 | [JsonPropertyName("hasMore")] 9 | [JsonProperty(PropertyName = "hasMore")] 10 | public bool HasMore { get; set; } 11 | 12 | [JsonPropertyName("id")] 13 | [JsonProperty(PropertyName = "id")] 14 | public string Id { get; set; } 15 | 16 | [JsonPropertyName("count")] 17 | [JsonProperty(PropertyName = "count")] 18 | public long Count { get; set; } 19 | 20 | [JsonPropertyName("extra")] 21 | [JsonProperty(PropertyName = "extra")] 22 | public QueryResponseExtra Extra { get; set; } 23 | } 24 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/QueryResponseBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | using Newtonsoft.Json; 4 | 5 | namespace Core.Arango.Protocol.Internal 6 | { 7 | internal abstract class QueryResponseBase : ArangoResponseBase 8 | { 9 | [JsonPropertyName("result")] 10 | [JsonProperty(PropertyName = "result")] 11 | public List Result { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/QueryResponseExtra.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class QueryResponseExtra 7 | { 8 | [JsonPropertyName("stats")] 9 | [JsonProperty(PropertyName = "stats")] 10 | public ArangoQueryStatistic Statistic { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/SingleResult.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class SingleResult 7 | { 8 | [JsonPropertyName("result")] 9 | [JsonProperty(PropertyName = "result")] 10 | public T Result { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Protocol/Internal/TransactionResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | using Newtonsoft.Json; 3 | 4 | namespace Core.Arango.Protocol.Internal 5 | { 6 | internal class TransactionResponse 7 | { 8 | [JsonPropertyName("id")] 9 | [JsonProperty("id")] 10 | public string Id { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/CloneContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using Core.Arango.Relinq.Clauses.Expressions; 19 | using Remotion.Utilities; 20 | 21 | namespace Core.Arango.Relinq.Clauses 22 | { 23 | /// 24 | /// Aggregates all objects needed in the process of cloning a and its clauses. 25 | /// 26 | internal sealed class CloneContext 27 | { 28 | public CloneContext(QuerySourceMapping querySourceMapping) 29 | { 30 | ArgumentUtility.CheckNotNull("querySourceMapping", querySourceMapping); 31 | 32 | QuerySourceMapping = querySourceMapping; 33 | } 34 | 35 | /// 36 | /// Gets the clause mapping used during the cloning process. This is used to adjust the 37 | /// instances 38 | /// of clauses to point to clauses in the cloned . 39 | /// 40 | public QuerySourceMapping QuerySourceMapping { get; } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/Expressions/IPartialEvaluationExceptionExpressionVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | namespace Core.Arango.Relinq.Clauses.Expressions 21 | { 22 | /// 23 | /// This interface should be implemented by visitors that handle the 24 | /// instances. 25 | /// 26 | internal interface IPartialEvaluationExceptionExpressionVisitor 27 | { 28 | Expression VisitPartialEvaluationException( 29 | PartialEvaluationExceptionExpression partialEvaluationExceptionExpression); 30 | } 31 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/Expressions/IVBSpecificExpressionVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | namespace Core.Arango.Relinq.Clauses.Expressions 21 | { 22 | /// 23 | /// This interface should be implemented by visitors that handle VB-specific expressions. 24 | /// 25 | internal interface IVBSpecificExpressionVisitor 26 | { 27 | Expression VisitVBStringComparison(VBStringComparisonExpression vbStringComparisonExpression); 28 | } 29 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/IClause.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | using System.Linq.Expressions; 20 | 21 | namespace Core.Arango.Relinq.Clauses 22 | { 23 | /// 24 | /// Represents a clause within the . Implemented by , 25 | /// , 26 | /// , and . 27 | /// 28 | internal interface IClause 29 | { 30 | /// 31 | /// Transforms all the expressions in this clause and its child objects via the given 32 | /// delegate. 33 | /// 34 | /// 35 | /// The transformation object. This delegate is called for each within this 36 | /// clause, and those expressions will be replaced with what the delegate returns. 37 | /// 38 | void TransformExpressions(Func transformation); 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/IFromClause.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | using JetBrains.Annotations; 20 | 21 | namespace Core.Arango.Relinq.Clauses 22 | { 23 | /// 24 | /// Common interface for from clauses ( and ). From 25 | /// clauses define query sources that 26 | /// provide data items to the query which are filtered, ordered, projected, or otherwise processed by the following 27 | /// clauses. 28 | /// 29 | internal interface IFromClause : IClause, IQuerySource 30 | { 31 | /// 32 | /// The expression generating the data items for this from clause. 33 | /// 34 | Expression FromExpression { get; } 35 | 36 | /// 37 | /// Copies the 's attributes, i.e. the , 38 | /// , and 39 | /// . 40 | /// 41 | /// 42 | void CopyFromSource([NotNull] IFromClause source); 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/OrderingDirection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | namespace Core.Arango.Relinq.Clauses 19 | { 20 | /// 21 | /// Specifies the direction used to sort the result items in a query using an . 22 | /// 23 | internal enum OrderingDirection 24 | { 25 | /// 26 | /// Sorts the items in an ascending way, from smallest to largest. 27 | /// 28 | Asc, 29 | 30 | /// 31 | /// Sorts the items in an descending way, from largest to smallest. 32 | /// 33 | Desc 34 | } 35 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/ResultOperators/SequenceFromSequenceResultOperatorBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Reflection; 19 | using Core.Arango.Relinq.Clauses.StreamedData; 20 | using Core.Arango.Relinq.Utilities; 21 | using Remotion.Utilities; 22 | 23 | namespace Core.Arango.Relinq.Clauses.ResultOperators 24 | { 25 | /// 26 | /// Represents a that is executed on a sequence, returning a new sequence as its 27 | /// result. 28 | /// 29 | internal abstract class SequenceFromSequenceResultOperatorBase : ResultOperatorBase 30 | { 31 | private static readonly MethodInfo s_executeMethod = 32 | typeof(SequenceFromSequenceResultOperatorBase).GetRuntimeMethodChecked("ExecuteInMemory", 33 | new[] {typeof(StreamedSequence)}); 34 | 35 | public abstract StreamedSequence ExecuteInMemory(StreamedSequence input); 36 | 37 | public sealed override IStreamedData ExecuteInMemory(IStreamedData input) 38 | { 39 | var sequenceInput = ArgumentUtility.CheckNotNullAndType("input", input); 40 | 41 | var executeMethod = s_executeMethod.MakeGenericMethod(sequenceInput.DataInfo.ResultItemType); 42 | return (StreamedSequence) InvokeExecuteMethod(executeMethod, sequenceInput); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/ResultOperators/SequenceTypePreservingResultOperatorBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq; 19 | using Core.Arango.Relinq.Clauses.StreamedData; 20 | using Remotion.Utilities; 21 | 22 | namespace Core.Arango.Relinq.Clauses.ResultOperators 23 | { 24 | /// 25 | /// Represents a that is executed on a sequence, returning a new 26 | /// sequence with the same 27 | /// item type as its result. 28 | /// 29 | internal abstract class SequenceTypePreservingResultOperatorBase : SequenceFromSequenceResultOperatorBase 30 | { 31 | public sealed override IStreamedDataInfo GetOutputDataInfo(IStreamedDataInfo inputInfo) 32 | { 33 | var inputSequenceInfo = ArgumentUtility.CheckNotNullAndType("inputInfo", inputInfo); 34 | return GetOutputDataInfo(inputSequenceInfo); 35 | } 36 | 37 | protected StreamedSequenceInfo GetOutputDataInfo(StreamedSequenceInfo inputSequenceInfo) 38 | { 39 | ArgumentUtility.CheckNotNull("inputSequenceInfo", inputSequenceInfo); 40 | return new StreamedSequenceInfo(typeof(IQueryable<>).MakeGenericType(inputSequenceInfo.ResultItemType), 41 | inputSequenceInfo.ItemExpression); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/ResultOperators/ValueFromSequenceResultOperatorBase.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Reflection; 19 | using Core.Arango.Relinq.Clauses.StreamedData; 20 | using Core.Arango.Relinq.Utilities; 21 | using Remotion.Utilities; 22 | 23 | namespace Core.Arango.Relinq.Clauses.ResultOperators 24 | { 25 | /// 26 | /// Represents a that is executed on a sequence, returning a scalar value or single 27 | /// item as its result. 28 | /// 29 | internal abstract class ValueFromSequenceResultOperatorBase : ResultOperatorBase 30 | { 31 | private static readonly MethodInfo s_executeMethod = 32 | typeof(ValueFromSequenceResultOperatorBase).GetRuntimeMethodChecked("ExecuteInMemory", 33 | new[] {typeof(StreamedSequence)}); 34 | 35 | public abstract StreamedValue ExecuteInMemory(StreamedSequence sequence); 36 | 37 | public sealed override IStreamedData ExecuteInMemory(IStreamedData input) 38 | { 39 | var sequenceInput = ArgumentUtility.CheckNotNullAndType("input", input); 40 | 41 | var executeMethod = s_executeMethod.MakeGenericMethod(sequenceInput.DataInfo.ResultItemType); 42 | return (StreamedValue) InvokeExecuteMethod(executeMethod, sequenceInput); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Clauses/StreamedData/IStreamedData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | namespace Core.Arango.Relinq.Clauses.StreamedData 19 | { 20 | /// 21 | /// Holds the data needed to represent the output or input of a part of a query in memory. This is mainly used for 22 | /// . The data held by implementations of this interface can be either 23 | /// a value or a sequence. 24 | /// 25 | internal interface IStreamedData 26 | { 27 | /// 28 | /// Gets an object describing the data held by this instance. 29 | /// 30 | /// 31 | /// An object describing the data held by this 32 | /// instance. 33 | /// 34 | IStreamedDataInfo DataInfo { get; } 35 | 36 | /// 37 | /// Gets the value held by this instance. 38 | /// 39 | /// The value. 40 | object Value { get; } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/AssertionMethodAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the marked method is assertion method, i.e. it halts control flow if one of the conditions is 33 | /// satisfied. 34 | /// To set the condition, mark one of the parameters with attribute 35 | /// 36 | /// 37 | [AttributeUsage(AttributeTargets.Method)] 38 | internal sealed class AssertionMethodAttribute : Attribute 39 | { 40 | } 41 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/CanBeNullAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the value of marked element could be null sometimes, so the check for null is 33 | /// necessary before its usage 34 | /// 35 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 36 | AttributeTargets.Delegate | AttributeTargets.Field)] 37 | internal sealed class CanBeNullAttribute : Attribute 38 | { 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/CannotApplyEqualityOperatorAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the value of marked type (or its derivatives) cannot be compared using '==' or '!=' operators. 33 | /// There is only exception to compare with null, it is permitted 34 | /// 35 | [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] 36 | internal sealed class CannotApplyEqualityOperatorAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/ImplicitUseTargetFlags.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Specify what is considered used implicitly when marked with or 33 | /// 34 | /// 35 | [Flags] 36 | internal enum ImplicitUseTargetFlags 37 | { 38 | Default = Itself, 39 | 40 | Itself = 1, 41 | 42 | /// 43 | /// Members of entity marked with attribute are considered used 44 | /// 45 | Members = 2, 46 | 47 | /// 48 | /// Entity marked with attribute and all its members considered used 49 | /// 50 | WithMembers = Itself | Members 51 | } 52 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/InstantHandleAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. 33 | /// If the parameter is delegate, indicates that delegate is executed while the method is executed. 34 | /// If the parameter is enumerable, indicates that it is enumerated while the method is executed. 35 | /// 36 | [AttributeUsage(AttributeTargets.Parameter)] 37 | internal sealed class InstantHandleAttribute : Attribute 38 | { 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/InvokerParameterNameAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the function argument should be string literal and match one of the parameters of the caller 33 | /// function. 34 | /// For example, has such parameter. 35 | /// 36 | [AttributeUsage(AttributeTargets.Parameter)] 37 | internal sealed class InvokerParameterNameAttribute : Attribute 38 | { 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/LinqTunnelAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that method is *pure* linq method, with postponed enumeration. C# iterator methods (yield ...) are always 33 | /// LinqTunnel. 34 | /// 35 | [AttributeUsage(AttributeTargets.Method)] 36 | internal sealed class LinqTunnelAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/NoEnumerationAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that IEnumarable, passed as parameter, is not enumerated. 33 | /// 34 | [AttributeUsage(AttributeTargets.Parameter)] 35 | internal sealed class NoEnumerationAttribute : Attribute 36 | { 37 | } 38 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/NotNullAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the value of marked element could never be null 33 | /// 34 | [AttributeUsage(AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | 35 | AttributeTargets.Delegate | AttributeTargets.Field)] 36 | internal sealed class NotNullAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/NotifyPropertyChangedInvocatorAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the function is used to notify class type property value is changed. 33 | /// 34 | [AttributeUsage(AttributeTargets.Method)] 35 | internal sealed class NotifyPropertyChangedInvocatorAttribute : Attribute 36 | { 37 | public NotifyPropertyChangedInvocatorAttribute() 38 | { 39 | } 40 | 41 | public NotifyPropertyChangedInvocatorAttribute(string parameterName) 42 | { 43 | ParameterName = parameterName; 44 | } 45 | 46 | public string ParameterName { get; } 47 | } 48 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/PathReferenceAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | [AttributeUsage(AttributeTargets.Parameter)] 32 | internal sealed class PathReferenceAttribute : Attribute 33 | { 34 | public PathReferenceAttribute() 35 | { 36 | } 37 | 38 | public PathReferenceAttribute([PathReference] string basePath) 39 | { 40 | BasePath = basePath; 41 | } 42 | 43 | public string BasePath { get; } 44 | } 45 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/PublicAPIAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// This attribute is intended to mark publicly available API which should not be removed and so is treated as used. 33 | /// 34 | [MeansImplicitUse] 35 | internal sealed class PublicAPIAttribute : Attribute 36 | { 37 | public PublicAPIAttribute() 38 | { 39 | } 40 | 41 | public PublicAPIAttribute(string comment) 42 | { 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/PureAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that method doesn't contain observable side effects. 33 | /// 34 | // The same as 35 | [AttributeUsage(AttributeTargets.Method)] 36 | internal sealed class PureAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Packages/TerminatesProgramAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | #pragma warning disable 1591 21 | // ReSharper disable UnusedMember.Global 22 | // ReSharper disable MemberCanBePrivate.Global 23 | // ReSharper disable UnusedAutoPropertyAccessor.Global 24 | // ReSharper disable IntroduceOptionalParameters.Global 25 | // ReSharper disable MemberCanBeProtected.Global 26 | // ReSharper disable InconsistentNaming 27 | // ReSharper disable once CheckNamespace 28 | 29 | namespace JetBrains.Annotations 30 | { 31 | /// 32 | /// Indicates that the marked method unconditionally terminates control flow execution. 33 | /// For example, it could unconditionally throw exception 34 | /// 35 | [AttributeUsage(AttributeTargets.Method)] 36 | internal sealed class TerminatesProgramAttribute : Attribute 37 | { 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ExpressionVisitors/MemberBindings/FieldInfoBinding.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | using System.Reflection; 20 | 21 | namespace Core.Arango.Relinq.Parsing.ExpressionVisitors.MemberBindings 22 | { 23 | /// 24 | /// Represents a being bound to an associated instance. This 25 | /// binding's 26 | /// method returns only for the same 27 | /// the expression is bound to. 28 | /// 29 | /// 30 | public class FieldInfoBinding : MemberBinding 31 | { 32 | public FieldInfoBinding(FieldInfo boundMember, Expression associatedExpression) 33 | : base(boundMember, associatedExpression) 34 | { 35 | } 36 | 37 | public override bool MatchesReadAccess(MemberInfo member) 38 | { 39 | return member == BoundMember; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ExpressionVisitors/Transformation/ExpressionTransformation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | namespace Core.Arango.Relinq.Parsing.ExpressionVisitors.Transformation 21 | { 22 | /// 23 | /// Transforms a given . If the can handle the 24 | /// , 25 | /// it should return a new, transformed instance. Otherwise, it should return the input 26 | /// 27 | /// instance. 28 | /// 29 | /// The expression to be transformed. 30 | /// The result of the transformation, or if no transformation was applied. 31 | internal delegate Expression ExpressionTransformation(Expression expression); 32 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ExpressionVisitors/Transformation/IExpressionTranformationProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Collections.Generic; 19 | using System.Linq.Expressions; 20 | 21 | namespace Core.Arango.Relinq.Parsing.ExpressionVisitors.Transformation 22 | { 23 | /// 24 | /// defines an API for classes returning 25 | /// instances for specific 26 | /// objects. Usually, the will be used when an 27 | /// implementation of this 28 | /// interface is needed. 29 | /// 30 | internal interface IExpressionTranformationProvider 31 | { 32 | /// 33 | /// Gets the transformers for the given . 34 | /// 35 | /// The to be transformed. 36 | /// 37 | /// A sequence containing objects that should be applied to the 38 | /// . Must not 39 | /// be . 40 | /// 41 | IEnumerable GetTransformations(Expression expression); 42 | } 43 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ExpressionVisitors/TreeEvaluation/NullEvaluatableExpressionFilter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | namespace Core.Arango.Relinq.Parsing.ExpressionVisitors.TreeEvaluation 19 | { 20 | /// 21 | /// Implementation of the null-object pattern for . 22 | /// 23 | /// 24 | internal sealed class NullEvaluatableExpressionFilter : EvaluatableExpressionFilterBase 25 | { 26 | } 27 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ExpressionVisitors/TreeEvaluation/PartialEvaluationInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Collections.Generic; 19 | using System.Linq.Expressions; 20 | using Remotion.Utilities; 21 | 22 | namespace Core.Arango.Relinq.Parsing.ExpressionVisitors.TreeEvaluation 23 | { 24 | internal class PartialEvaluationInfo 25 | { 26 | private readonly HashSet _evaluatableExpressions = new(); 27 | 28 | public int Count => _evaluatableExpressions.Count; 29 | 30 | public void AddEvaluatableExpression(Expression expression) 31 | { 32 | ArgumentUtility.CheckNotNull("expression", expression); 33 | _evaluatableExpressions.Add(expression); 34 | } 35 | 36 | public bool IsEvaluatableExpression(Expression expression) 37 | { 38 | ArgumentUtility.CheckNotNull("expression", expression); 39 | return _evaluatableExpressions.Contains(expression); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/ParserException.Obsolete.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | namespace Core.Arango.Relinq.Parsing 21 | { 22 | [Obsolete("Infrastructure uses NotSupportedException instead. (Version 1.15.12.0)", true)] 23 | internal abstract class ParserException : Exception 24 | { 25 | private ParserException() 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/ExpressionTreeProcessors/NullExpressionTreeProcessor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | using Remotion.Utilities; 20 | 21 | namespace Core.Arango.Relinq.Parsing.Structure.ExpressionTreeProcessors 22 | { 23 | /// 24 | /// Implements the interface by doing nothing in the 25 | /// method. This is an 26 | /// implementation of the Null Object Pattern. 27 | /// 28 | internal sealed class NullExpressionTreeProcessor : IExpressionTreeProcessor 29 | { 30 | public Expression Process(Expression expressionTree) 31 | { 32 | ArgumentUtility.CheckNotNull("expressionTree", expressionTree); 33 | return expressionTree; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/IQueryParser.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | namespace Core.Arango.Relinq.Parsing.Structure 21 | { 22 | /// 23 | /// is implemented by classes taking an tree and parsing it into 24 | /// a . 25 | /// 26 | /// 27 | /// The default implementation of this interface is . LINQ providers can, however, implement 28 | /// 29 | /// themselves, eg. in order to decorate or replace the functionality of . 30 | /// 31 | internal interface IQueryParser 32 | { 33 | /// 34 | /// Gets the of the given . 35 | /// 36 | /// The expression tree to parse. 37 | /// A that represents the query defined in . 38 | QueryModel GetParsedQuery(Expression expressionTreeRoot); 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/IntermediateModel/ExpressionNodeInstantiationException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | 20 | namespace Core.Arango.Relinq.Parsing.Structure.IntermediateModel 21 | { 22 | /// 23 | /// Thrown whan an parser cannot be instantiated for a query. Note that this 24 | /// is not serializable 25 | /// and intended to be caught in the call-site where it will then replaced by a different (serializable) exception. 26 | /// 27 | internal sealed class ExpressionNodeInstantiationException : Exception 28 | { 29 | internal ExpressionNodeInstantiationException(string message) 30 | : base(message) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/IntermediateModel/IQuerySourceExpressionNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | namespace Core.Arango.Relinq.Parsing.Structure.IntermediateModel 21 | { 22 | /// 23 | /// Interface for classes representing query source parts of an tree. 24 | /// 25 | internal interface IQuerySourceExpressionNode : IExpressionNode 26 | { 27 | } 28 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/IntermediateModel/ResolvedExpressionCache.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | using System.Linq.Expressions; 20 | using Remotion.Utilities; 21 | 22 | namespace Core.Arango.Relinq.Parsing.Structure.IntermediateModel 23 | { 24 | /// 25 | /// Caches a resolved expression in the classes. 26 | /// 27 | internal sealed class ResolvedExpressionCache 28 | where T : Expression 29 | { 30 | private readonly ExpressionResolver _resolver; 31 | private T _cachedExpression; 32 | 33 | public ResolvedExpressionCache(IExpressionNode currentNode) 34 | { 35 | ArgumentUtility.CheckNotNull("currentNode", currentNode); 36 | 37 | _resolver = new ExpressionResolver(currentNode); 38 | _cachedExpression = null; 39 | } 40 | 41 | public T GetOrCreate(Func generator) 42 | { 43 | if (_cachedExpression == null) 44 | _cachedExpression = generator(_resolver); 45 | 46 | return _cachedExpression; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Parsing/Structure/NodeTypeProviders/NameBasedRegistrationInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System; 19 | using System.Reflection; 20 | using Remotion.Utilities; 21 | 22 | namespace Core.Arango.Relinq.Parsing.Structure.NodeTypeProviders 23 | { 24 | /// 25 | /// Defines a name and a filter predicate used when determining the matching expression node type by 26 | /// . 27 | /// 28 | internal sealed class NameBasedRegistrationInfo 29 | { 30 | public NameBasedRegistrationInfo(string name, Func filter) 31 | { 32 | ArgumentUtility.CheckNotNullOrEmpty("name", name); 33 | ArgumentUtility.CheckNotNull("filter", filter); 34 | 35 | Name = name; 36 | Filter = filter; 37 | } 38 | 39 | public string Name { get; } 40 | 41 | public Func Filter { get; } 42 | } 43 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Utilities/ExpressionExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Linq.Expressions; 19 | 20 | #if NET_3_5 21 | using Remotion.Linq.Clauses.ExpressionVisitors; 22 | #endif 23 | 24 | namespace Core.Arango.Relinq.Utilities 25 | { 26 | /// 27 | /// Provides extensions for working with trees. 28 | /// 29 | internal static class ExpressionExtensions 30 | { 31 | /// 32 | /// Builds a string from the tree, including .NET 3.5. 33 | /// 34 | public static string BuildString(this Expression expression) 35 | { 36 | #if !NET_3_5 37 | return expression.ToString(); 38 | #else 39 | return FormattingExpressionVisitor.Format(expression); 40 | #endif 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Utilities/ReflectionExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using JetBrains.Annotations; 19 | #if !NET_4_0 && !NET_3_5 20 | using Remotion.Utilities; 21 | 22 | #endif 23 | 24 | // ReSharper disable once CheckNamespace 25 | namespace System.Reflection 26 | { 27 | internal static class ReflectionExtensions 28 | { 29 | #if !NET_4_0 && !NET_3_5 30 | [CanBeNull] 31 | public static MethodInfo GetGetMethod([NotNull] this PropertyInfo propertyInfo, bool nonPublic) 32 | { 33 | Assertion.DebugAssert(nonPublic, "Parameter 'nonPublic' must be invoked with 'true'."); 34 | 35 | return propertyInfo.GetMethod; 36 | } 37 | #endif 38 | } 39 | } -------------------------------------------------------------------------------- /Core.Arango/Relinq/Utilities/StringUtility.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) rubicon IT GmbH, www.rubicon.eu 2 | // 3 | // See the NOTICE file distributed with this work for additional information 4 | // regarding copyright ownership. rubicon licenses this file to you under 5 | // the Apache License, Version 2.0 (the "License"); you may not use this 6 | // file except in compliance with the License. You may obtain a copy of the 7 | // License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations 15 | // under the License. 16 | // 17 | 18 | using System.Collections.Generic; 19 | 20 | #if NET_3_5 21 | using System.Linq; 22 | #endif 23 | 24 | namespace Core.Arango.Relinq.Utilities 25 | { 26 | internal static class StringUtility 27 | { 28 | public static string Join(string separator, IEnumerable values) 29 | { 30 | #if !NET_3_5 31 | return string.Join(separator, values); 32 | #else 33 | if (typeof (T) == typeof (string)) 34 | return string.Join (separator, values.Cast().ToArray()); 35 | else 36 | return string.Join (separator, values.Select (v=>v.ToString()).ToArray()); 37 | #endif 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/IArangoFormattable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango.Serialization 4 | { 5 | /// 6 | /// Special interface for custom formattable query parts 7 | /// 8 | public interface IArangoFormattable : IFormattable 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/IArangoSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Core.Arango.Serialization 4 | { 5 | /// 6 | /// Arango Serializer Interface 7 | /// 8 | public interface IArangoSerializer 9 | { 10 | /// 11 | /// Convert object to string 12 | /// 13 | public string Serialize(object value); 14 | 15 | /// 16 | /// Convert string to object 17 | /// 18 | public T Deserialize(string value); 19 | 20 | /// 21 | /// Convert string to object 22 | /// 23 | public object Deserialize(string value, Type type); 24 | } 25 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/Json/ArangoJsonDefaultPolicy.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json; 2 | 3 | namespace Core.Arango.Serialization.Json 4 | { 5 | /// 6 | /// System.Json.Text PascalCase Naming Policy for Arango 7 | /// 8 | public class ArangoJsonDefaultPolicy : JsonNamingPolicy 9 | { 10 | /// 11 | public override string ConvertName(string name) 12 | { 13 | return name switch 14 | { 15 | "Id" => "_id", 16 | "Key" => "_key", 17 | "Revision" => "_rev", 18 | "From" => "_from", 19 | "To" => "_to", 20 | _ => name 21 | }; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/Newtonsoft/ArangoNewtonsoftCamelCaseContractResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Core.Arango.Serialization.Newtonsoft 6 | { 7 | /// 8 | /// Newtonsoft camelCase Naming Policy for Arango 9 | /// 10 | public class ArangoNewtonsoftCamelCaseContractResolver : DefaultContractResolver 11 | { 12 | /// 13 | public ArangoNewtonsoftCamelCaseContractResolver() 14 | { 15 | NamingStrategy = new CamelCaseNamingStrategy(); 16 | } 17 | 18 | /// 19 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 20 | { 21 | var property = base.CreateProperty(member, memberSerialization); 22 | 23 | if (member.GetCustomAttribute() != null) 24 | { 25 | property.ShouldDeserialize = i => true; 26 | property.ShouldSerialize = i => false; 27 | } 28 | 29 | var atr = member.GetCustomAttribute(); 30 | 31 | if (atr?.PropertyName == null) 32 | property.PropertyName = property.PropertyName switch 33 | { 34 | "id" => "_id", 35 | "key" => "_key", 36 | "revision" => "_rev", 37 | "from" => "_from", 38 | "to" => "_to", 39 | _ => property.PropertyName 40 | }; 41 | 42 | return property; 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/Newtonsoft/ArangoNewtonsoftDefaultContractResolver.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Core.Arango.Serialization.Newtonsoft 6 | { 7 | /// 8 | /// System.Json.Text PascalCase Naming Policy for Arango 9 | /// 10 | public class ArangoNewtonsoftDefaultContractResolver : DefaultContractResolver 11 | { 12 | /// 13 | /// System.Json.Text PascalCase Naming Policy for Arango 14 | /// 15 | public ArangoNewtonsoftDefaultContractResolver() 16 | { 17 | NamingStrategy = new DefaultNamingStrategy(); 18 | } 19 | 20 | /// 21 | protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) 22 | { 23 | var property = base.CreateProperty(member, memberSerialization); 24 | 25 | if (member.GetCustomAttribute() != null) 26 | { 27 | property.ShouldDeserialize = i => true; 28 | property.ShouldSerialize = i => false; 29 | } 30 | 31 | property.PropertyName = property.PropertyName switch 32 | { 33 | "Id" => "_id", 34 | "Key" => "_key", 35 | "Revision" => "_rev", 36 | "From" => "_from", 37 | "To" => "_to", 38 | _ => property.PropertyName 39 | }; 40 | 41 | return property; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Core.Arango/Serialization/Newtonsoft/ArangoNewtonsoftSerializer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Newtonsoft.Json; 3 | using Newtonsoft.Json.Serialization; 4 | 5 | namespace Core.Arango.Serialization.Newtonsoft 6 | { 7 | /// 8 | /// Arango Json Serializer with Newtonsoft 9 | /// 10 | public class ArangoNewtonsoftSerializer : IArangoSerializer 11 | { 12 | private readonly JsonSerializerSettings _settings; 13 | 14 | /// 15 | /// Arango Json Serializer with Newtonsoft 16 | /// 17 | /// PascalCase or camelCaseResolver 18 | public ArangoNewtonsoftSerializer(IContractResolver resolver) 19 | { 20 | _settings = new JsonSerializerSettings 21 | { 22 | ContractResolver = resolver, 23 | ReferenceLoopHandling = ReferenceLoopHandling.Ignore, 24 | Formatting = Formatting.None, 25 | DateFormatHandling = DateFormatHandling.IsoDateFormat, 26 | DateTimeZoneHandling = DateTimeZoneHandling.Utc 27 | }; 28 | } 29 | 30 | /// 31 | public string Serialize(object value) 32 | { 33 | return JsonConvert.SerializeObject(value, _settings); 34 | } 35 | 36 | /// 37 | public T Deserialize(string value) 38 | { 39 | return JsonConvert.DeserializeObject(value, _settings); 40 | } 41 | 42 | /// 43 | public object Deserialize(string v, Type t) 44 | { 45 | return JsonConvert.DeserializeObject(v, t, _settings); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Core.Arango/Transport/IArangoTransport.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net.Http; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Core.Arango.Transport 8 | { 9 | /// 10 | /// Arango Transport Interface 11 | /// 12 | public interface IArangoTransport 13 | { 14 | /// 15 | /// Send request to ArangoDB 16 | /// 17 | ValueTask SendAsync(Type type, HttpMethod m, string url, object body = null, string transaction = null, 18 | bool throwOnError = true, bool auth = true, IDictionary headers = null, 19 | CancellationToken cancellationToken = default); 20 | 21 | /// 22 | /// Send request to ArangoDB 23 | /// 24 | ValueTask SendAsync(HttpMethod m, string url, object body = null, string transaction = null, 25 | bool throwOnError = true, bool auth = true, IDictionary headers = null, 26 | CancellationToken cancellationToken = default); 27 | 28 | /// 29 | /// Send raw HTTP content request to ArangoDB 30 | /// 31 | ValueTask SendContentAsync(HttpMethod m, string url, HttpContent body = null, string transaction = null, 32 | bool throwOnError = true, bool auth = true, IDictionary headers = null, 33 | CancellationToken cancellationToken = default); 34 | } 35 | } -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Linq support is a derivative work based on 2 | 3 | https://github.com/ra0o0f/arangoclient.net 4 | Copyright (c) raoof hojat jalali Apache-2.0 5 | 6 | and 7 | 8 | https://github.com/re-motion/Relinq 9 | Copyright (c) rubicon IT GmbH, www.rubicon.eu Apache-2.0 10 | 11 | ALL FILES HAVE BEEN MODIFIED SINCE 12 | 13 | -------------------------------------------------------------------------------- /docker/clean_cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for c in agent1 \ 4 | agent2 \ 5 | agent3 \ 6 | dbserver1 \ 7 | dbserver2 \ 8 | coordinator1 \ 9 | coordinator2; do 10 | docker rm -f $c 11 | done 12 | -------------------------------------------------------------------------------- /docker/clean_single.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker rm -f arangodb 4 | -------------------------------------------------------------------------------- /docker/debug_containers_cluster.sh: -------------------------------------------------------------------------------- 1 | debug_container() { 2 | echo "=== === === ===" 3 | echo "=== $1" 4 | 5 | running=$(docker inspect -f '{{.State.Running}}' "$1") 6 | 7 | if [ "$running" = false ]; then 8 | echo "=== $1 IS NOT RUNNING!" 9 | fi 10 | 11 | echo "=== === === ===" 12 | 13 | docker logs "$1" 14 | } 15 | 16 | for c in agent1 \ 17 | agent2 \ 18 | agent3 \ 19 | dbserver1 \ 20 | dbserver2 \ 21 | coordinator1 \ 22 | coordinator2; do 23 | debug_container $c 24 | done 25 | -------------------------------------------------------------------------------- /docker/debug_containers_single.sh: -------------------------------------------------------------------------------- 1 | container_name="arangodb" 2 | 3 | debug_container() { 4 | echo "=== === === ===" 5 | echo "=== $1" 6 | 7 | running=$(docker inspect -f '{{.State.Running}}' "$1") 8 | 9 | if [ "$running" = false ]; then 10 | echo "=== $1 IS NOT RUNNING!" 11 | fi 12 | 13 | echo "=== === === ===" 14 | 15 | docker logs "$1" 16 | } 17 | 18 | debug_container $container_name 19 | -------------------------------------------------------------------------------- /docker/server.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIICKTCCAZICCQDrch/8O8H4PTANBgkqhkiG9w0BAQUFADBZMQswCQYDVQQGEwJE 3 | RTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0 4 | cyBQdHkgTHRkMRIwEAYDVQQDDAlsb2NhbGhvc3QwHhcNMTIwNzI0MDYxNzUwWhcN 5 | MTMwNzI0MDYxNzUwWjBZMQswCQYDVQQGEwJERTETMBEGA1UECAwKU29tZS1TdGF0 6 | ZTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIwEAYDVQQDDAls 7 | b2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMDwRweF75H+BFBY 8 | m9c4V/AZyWehxQ+pRfy6d+oPiUbOByqLDEQBdiMamQ0acJX9sn+MsFixEDRC1Y8r 9 | ef49k1hb9V/pPtSFPVl5y8Db4FiDabKD9juUvNRqCXAzu99dwJwFZU2Ldq4BiCmf 10 | 8V0SO+nHJHs3+HNgbYU+g77Fax7dAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEASYfI 11 | Afq5lRn+XoESn+PQ89XJ83Jr5mJhDkT7ebw+w1CQsnR9uYIeAYNxOyb3bfHOntnz 12 | 3irGYJWkrewVYjNkID8jhZSYEOZkfC4jxNLigg7QXyw/XWwwCIEr8/ZW+cnci43G 13 | +IhSspyoJnljELM99ZsW0IaBLT+tgHzep4bIh0Y= 14 | -----END CERTIFICATE----- 15 | -----BEGIN RSA PRIVATE KEY----- 16 | MIICXgIBAAKBgQDA8EcHhe+R/gRQWJvXOFfwGclnocUPqUX8unfqD4lGzgcqiwxE 17 | AXYjGpkNGnCV/bJ/jLBYsRA0QtWPK3n+PZNYW/Vf6T7UhT1ZecvA2+BYg2myg/Y7 18 | lLzUaglwM7vfXcCcBWVNi3auAYgpn/FdEjvpxyR7N/hzYG2FPoO+xWse3QIDAQAB 19 | AoGBALsP+34C0M02gI456xbXDQPArLJqePp/P1kSnbL0zz80AGSyHflNhXHxltTK 20 | fsAeElNyX4QOYEybRB2kpInov5KrL3lR926GY++otHpSAue+PfLJHH8OU8qjartw 21 | KGlzdnFFYQVLNc0qYGl/h0MxH6+Ce8JV0y1zI4J3nwMwCZwBAkEA6uqluGj4SXIj 22 | 6W+FefuHlHXgFn+TZgsGNNmmCMhLJPUUP7auIagtG1n12mN47kWqhLu3asLEVq4+ 23 | YnCEa0hF3QJBANJBKN/zyfmvkiET33cY03282gSN0YLyibMYoNDOOYMFEW2b+3oF 24 | x0d40FfEkYS0R4rJiR1HI8xWw8uQEWsXLQECQQDRx1DN6Q8vpznij7BGShO8w7ak 25 | 4LAkA9w6/dGDLjnMev7mFqBRdfkx35foucOYI6YueeNE90CVl2wmRAw8MYIRAkEA 26 | qUUgPTyuDMCWqt6u99ka243hD+2FESFmTrOzNKfykVLRNydvDEv+pcHUKfTtGqNx 27 | PYEHTHTrkyT/OLFh9I+SAQJAOntw15vhgKiy0DUvjSvXGJziBDPsu/MCZ2CZbaVx 28 | ipkUZQCZLd/HvMphAiirLV+mAJQC732KKlR9/HWRzDDFEQ== 29 | -----END RSA PRIVATE KEY----- 30 | -------------------------------------------------------------------------------- /docker/start_db_cluster_retry_fail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # USAGE: 4 | # export ARANGO_LICENSE_KEY= 5 | # ./docker/start_db_cluster_retry_fail.sh 6 | 7 | # EXAMPLE: 8 | # ./docker/start_db_cluster_retry_fail.sh docker.io/arangodb/arangodb:3.7.1 9 | 10 | ./docker/start_db_cluster.sh "$1" 11 | while [ $? -ne 0 ]; do 12 | echo "=== === ===" 13 | echo "cluster startup failed, retrying ..." 14 | ./docker/clean_cluster.sh 15 | ./docker/start_db_cluster.sh "$1" 16 | done 17 | -------------------------------------------------------------------------------- /docker/start_db_single.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # USAGE: 4 | # export ARANGO_LICENSE_KEY= 5 | # ./start_db_single.sh 6 | 7 | # EXAMPLE: 8 | # ./start_db_single.sh docker.io/arangodb/arangodb:3.7.1 9 | 10 | docker pull "$1" 11 | 12 | docker network create arangodb --subnet 172.28.0.0/16 13 | 14 | docker run -d -e ARANGO_ROOT_PASSWORD=test -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" --network arangodb --ip 172.28.3.1 --name arangodb "$1" 15 | 16 | debug_container() { 17 | if [ ! "$(docker ps -aqf name="$1")" ]; then 18 | echo "$1 container not found!" 19 | exit 1 20 | fi 21 | 22 | running=$(docker inspect -f '{{.State.Running}}' "$1") 23 | 24 | if [ "$running" = false ] 25 | then 26 | echo "$1 is not running!" 27 | echo "---" 28 | docker logs "$1" 29 | echo "---" 30 | exit 1 31 | fi 32 | } 33 | 34 | echo "waiting for arangodb ..." 35 | 36 | # shellcheck disable=SC2091 37 | until $(curl --output /dev/null --silent --head --fail -i -u root:test 'http://172.28.3.1:8529/_api/version'); do 38 | printf '.' 39 | debug_container arangodb 40 | sleep 1 41 | done 42 | echo "READY!" 43 | -------------------------------------------------------------------------------- /docker/start_db_single_retry_fail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # USAGE: 4 | # export ARANGO_LICENSE_KEY= 5 | # ./docker/start_db_single_retry_fail.sh 6 | 7 | # EXAMPLE: 8 | # ./docker/start_db_single_retry_fail.sh docker.io/arangodb/arangodb:3.7.1 9 | 10 | ./docker/start_db_single.sh "$1" 11 | while [ $? -ne 0 ]; do 12 | echo "=== === ===" 13 | echo "single startup failed, retrying ..." 14 | ./docker/clean_single.sh 15 | ./docker/start_db_single.sh "$1" 16 | done 17 | -------------------------------------------------------------------------------- /docker/start_db_single_ssl.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # USAGE: 4 | # export ARANGO_LICENSE_KEY= 5 | # ./start_db_single_ssl.sh 6 | 7 | # EXAMPLE: 8 | # ./start_db_single_ssl.sh docker.io/arangodb/arangodb:3.7.1 9 | 10 | docker pull "$1" 11 | 12 | docker run -d -p 8529:8529 -e ARANGO_ROOT_PASSWORD=test -e ARANGO_LICENSE_KEY="$ARANGO_LICENSE_KEY" -v $(pwd)/server.pem:/server.pem "$1" arangod --ssl.keyfile /server.pem --server.endpoint ssl://0.0.0.0:8529 13 | 14 | echo "waiting for arangodb ..." 15 | 16 | # shellcheck disable=SC2091 17 | until $(curl --output /dev/null --silent --head --fail -i --insecure -u root:test 'https://localhost:8529/_api/version'); do 18 | printf '.' 19 | sleep 1 20 | done 21 | echo "READY!" 22 | --------------------------------------------------------------------------------