Initial commit
This commit is contained in:
		
							parent
							
								
									a77631658d
								
							
						
					
					
						commit
						cfb6fa7f37
					
				
							
								
								
									
										19
									
								
								Connected.ServiceModel/Connected.ServiceModel.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								Connected.ServiceModel/Connected.ServiceModel.csproj
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,19 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>net7.0</TargetFramework>
 | 
			
		||||
    <ImplicitUsings>enable</ImplicitUsings>
 | 
			
		||||
    <Nullable>enable</Nullable>
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0-rc.2.22472.3" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <ProjectReference Include="..\..\Connected\Connected\Connected.csproj" />
 | 
			
		||||
    <ProjectReference Include="..\..\Framework\Connected.Entities\Connected.Entities.csproj" />
 | 
			
		||||
    <ProjectReference Include="..\..\Framework\Connected.Runtime\Connected.Runtime.csproj" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
							
								
								
									
										10
									
								
								Connected.ServiceModel/Data/ITableEntity.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Connected.ServiceModel/Data/ITableEntity.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
using Connected.Entities.Consistency;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Data;
 | 
			
		||||
 | 
			
		||||
public interface ITableEntity<TPrimaryKey, TPartitionKey> : IConsistentEntity<TPrimaryKey>
 | 
			
		||||
	where TPrimaryKey : notnull
 | 
			
		||||
	where TPartitionKey : notnull
 | 
			
		||||
{
 | 
			
		||||
	TPartitionKey PartitionKey { get; init; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								Connected.ServiceModel/Data/ITableService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Connected.ServiceModel/Data/ITableService.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Data;
 | 
			
		||||
 | 
			
		||||
public interface ITableService
 | 
			
		||||
{
 | 
			
		||||
	Task<ImmutableList<TTableEntity>> Query<TTableEntity>(string commandText);
 | 
			
		||||
 | 
			
		||||
	Task<TTableEntity?> Select<TTableEntity, TPrimaryKey>(string commandText);
 | 
			
		||||
 | 
			
		||||
	Task Execute(string commandText);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								Connected.ServiceModel/Data/TableEntity.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								Connected.ServiceModel/Data/TableEntity.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
using Connected.Annotations;
 | 
			
		||||
using Connected.Entities.Consistency;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Data;
 | 
			
		||||
 | 
			
		||||
public abstract record TableEntity<TPrimaryKey, TPartitionKey> : ConsistentEntity<TPrimaryKey>, ITableEntity<TPrimaryKey, TPartitionKey>
 | 
			
		||||
	where TPrimaryKey : notnull
 | 
			
		||||
	where TPartitionKey : notnull
 | 
			
		||||
{
 | 
			
		||||
	[Ordinal(-1)]
 | 
			
		||||
	public TPartitionKey PartitionKey { get; init; } = default!;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										11
									
								
								Connected.ServiceModel/Search/ISearchEntity.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Connected.ServiceModel/Search/ISearchEntity.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
			
		||||
using Connected.Entities.Consistency;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Search;
 | 
			
		||||
public interface ISearchEntity<TPrimaryKey> : IConsistentEntity<TPrimaryKey>
 | 
			
		||||
	where TPrimaryKey : notnull
 | 
			
		||||
{
 | 
			
		||||
	int Author { get; init; }
 | 
			
		||||
	DateTimeOffset? Created { get; init; }
 | 
			
		||||
	int Language { get; init; }
 | 
			
		||||
	string? Tags { get; init; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										15
									
								
								Connected.ServiceModel/Search/ISearchService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								Connected.ServiceModel/Search/ISearchService.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,15 @@
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
using Connected.Entities;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Search;
 | 
			
		||||
 | 
			
		||||
public interface ISearchService
 | 
			
		||||
{
 | 
			
		||||
	Task<ImmutableList<TEntity>> Query<TEntity>(string catalog, string criteria);
 | 
			
		||||
 | 
			
		||||
	Task Update<TEntity>(string catalog, TEntity entity)
 | 
			
		||||
		where TEntity : IEntity;
 | 
			
		||||
 | 
			
		||||
	Task Update<TEntity>(string catalog, IEnumerable<TEntity> entity)
 | 
			
		||||
		where TEntity : IEntity;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								Connected.ServiceModel/Search/SearchEntity.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Connected.ServiceModel/Search/SearchEntity.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,20 @@
 | 
			
		||||
using Connected.Annotations;
 | 
			
		||||
using Connected.Entities.Annotations;
 | 
			
		||||
using Connected.Entities.Consistency;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Search;
 | 
			
		||||
public record SearchEntity<TPrimaryKey> : ConsistentEntity<TPrimaryKey>, ISearchEntity<TPrimaryKey>
 | 
			
		||||
	where TPrimaryKey : notnull
 | 
			
		||||
{
 | 
			
		||||
	[Ordinal(0)]
 | 
			
		||||
	public int Author { get; init; }
 | 
			
		||||
 | 
			
		||||
	[Ordinal(1)]
 | 
			
		||||
	public DateTimeOffset? Created { get; init; }
 | 
			
		||||
 | 
			
		||||
	[Ordinal(2)]
 | 
			
		||||
	public int Language { get; init; }
 | 
			
		||||
 | 
			
		||||
	[Ordinal(3), Nullable]
 | 
			
		||||
	public string? Tags { get; init; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								Connected.ServiceModel/Search/SearchExtensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Connected.ServiceModel/Search/SearchExtensions.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
namespace Connected.ServiceModel.Search;
 | 
			
		||||
public static class SearchExtensions
 | 
			
		||||
{
 | 
			
		||||
	public static IEnumerable<TEntity> WithPaging<TEntity>(this IEnumerable<TEntity> entities, SearchArgs args)
 | 
			
		||||
	{
 | 
			
		||||
		return entities.Skip((args.Paging.Index - 1) * args.Paging.Size)
 | 
			
		||||
				.Take(args.Paging.Size);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								Connected.ServiceModel/ServiceArgs.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								Connected.ServiceModel/ServiceArgs.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,13 @@
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel;
 | 
			
		||||
 | 
			
		||||
public class ServiceArgs : Dto
 | 
			
		||||
{
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(128)]
 | 
			
		||||
	public string AccessToken { get; set; } = default!;
 | 
			
		||||
 | 
			
		||||
	[Range(1, int.MaxValue)]
 | 
			
		||||
	public int Subscription { get; set; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										9
									
								
								Connected.ServiceModel/ServiceModelStartup.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								Connected.ServiceModel/ServiceModelStartup.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
using Connected.Annotations;
 | 
			
		||||
 | 
			
		||||
[assembly: MicroService(MicroServiceType.Sys)]
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel;
 | 
			
		||||
 | 
			
		||||
internal sealed class ServiceModelStartup : Startup
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										7
									
								
								Connected.ServiceModel/Storage/IDirectory.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Connected.ServiceModel/Storage/IDirectory.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,7 @@
 | 
			
		||||
namespace Connected.ServiceModel.Storage;
 | 
			
		||||
 | 
			
		||||
public interface IDirectory
 | 
			
		||||
{
 | 
			
		||||
   string Name { get; }
 | 
			
		||||
   DateTime Created { get; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								Connected.ServiceModel/Storage/IFile.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								Connected.ServiceModel/Storage/IFile.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
namespace Connected.ServiceModel.Storage;
 | 
			
		||||
 | 
			
		||||
public interface IFile
 | 
			
		||||
{
 | 
			
		||||
   string Name { get; }
 | 
			
		||||
   DateTime Created { get; }
 | 
			
		||||
   long Size { get; }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										24
									
								
								Connected.ServiceModel/Storage/IStorageService.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								Connected.ServiceModel/Storage/IStorageService.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,24 @@
 | 
			
		||||
using System.Collections.Immutable;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Storage;
 | 
			
		||||
 | 
			
		||||
public interface IStorageService
 | 
			
		||||
{
 | 
			
		||||
	Task<ImmutableList<IFile>?> QueryFiles(DirectoryArgs args);
 | 
			
		||||
 | 
			
		||||
	Task<ImmutableList<IDirectory>?> QueryDirectories(DirectoryArgs args);
 | 
			
		||||
 | 
			
		||||
	Task<byte[]?> SelectFile(FileArgs args);
 | 
			
		||||
 | 
			
		||||
	Task UpdateFile(UpdateFileArgs args);
 | 
			
		||||
 | 
			
		||||
	Task DeleteFile(DeleteFileArgs args);
 | 
			
		||||
 | 
			
		||||
	Task MoveFile(MoveFileArgs args);
 | 
			
		||||
 | 
			
		||||
	Task InsertDirectory(InsertDirectoryArgs args);
 | 
			
		||||
 | 
			
		||||
	Task UpdateDirectory(UpdateDirectoryArgs args);
 | 
			
		||||
 | 
			
		||||
	Task DeleteDirectory(DeleteDirectoryArgs args);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										59
									
								
								Connected.ServiceModel/Storage/StorageArgs.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								Connected.ServiceModel/Storage/StorageArgs.cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,59 @@
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
 | 
			
		||||
namespace Connected.ServiceModel.Storage;
 | 
			
		||||
 | 
			
		||||
public class FileArgs : ServiceArgs
 | 
			
		||||
{
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(1024)]
 | 
			
		||||
	public string Directory { get; set; } = default!;
 | 
			
		||||
 | 
			
		||||
	[MaxLength(256)]
 | 
			
		||||
	[Required]
 | 
			
		||||
	public string FileName { get; set; } = default!;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class DeleteFileArgs : FileArgs
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class UpdateFileArgs : FileArgs
 | 
			
		||||
{
 | 
			
		||||
	public byte[]? Content { get; set; }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class MoveFileArgs : FileArgs
 | 
			
		||||
{
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(256)]
 | 
			
		||||
	public string NewFileName { get; set; } = default!;
 | 
			
		||||
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(1024)]
 | 
			
		||||
	public string NewDirectory { get; set; } = default!;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public class DirectoryArgs : ServiceArgs
 | 
			
		||||
{
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(1024)]
 | 
			
		||||
	public string Path { get; set; } = default!;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class InsertDirectoryArgs : DirectoryArgs
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class UpdateDirectoryArgs : DirectoryArgs
 | 
			
		||||
{
 | 
			
		||||
	[Required]
 | 
			
		||||
	[MaxLength(1024)]
 | 
			
		||||
	public string NewPath { get; set; } = default!;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
public sealed class DeleteDirectoryArgs : DirectoryArgs
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										50
									
								
								Framework.ServiceModel.sln
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								Framework.ServiceModel.sln
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,50 @@
 | 
			
		||||
 | 
			
		||||
Microsoft Visual Studio Solution File, Format Version 12.00
 | 
			
		||||
# Visual Studio Version 17
 | 
			
		||||
VisualStudioVersion = 17.4.33027.239
 | 
			
		||||
MinimumVisualStudioVersion = 10.0.40219.1
 | 
			
		||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dependencies", "Dependencies", "{6EFC1819-8C82-49C6-B893-B84E8C218560}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected.ServiceModel", "Connected.ServiceModel\Connected.ServiceModel.csproj", "{EEAAA364-FCF2-4975-8321-A475778D684C}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected", "..\Connected\Connected\Connected.csproj", "{6F70D808-2CB4-4844-B72C-BE01E91C7861}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected.Runtime", "..\Framework\Connected.Runtime\Connected.Runtime.csproj", "{DDC87725-25E6-44C9-ABAC-C93FF4171F4B}"
 | 
			
		||||
EndProject
 | 
			
		||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Connected.Entities", "..\Framework\Connected.Entities\Connected.Entities.csproj", "{99F5300F-E8A1-497A-835D-813890F4EA8A}"
 | 
			
		||||
EndProject
 | 
			
		||||
Global
 | 
			
		||||
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 | 
			
		||||
		Debug|Any CPU = Debug|Any CPU
 | 
			
		||||
		Release|Any CPU = Release|Any CPU
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 | 
			
		||||
		{EEAAA364-FCF2-4975-8321-A475778D684C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
			
		||||
		{EEAAA364-FCF2-4975-8321-A475778D684C}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
			
		||||
		{EEAAA364-FCF2-4975-8321-A475778D684C}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
			
		||||
		{EEAAA364-FCF2-4975-8321-A475778D684C}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
			
		||||
		{6F70D808-2CB4-4844-B72C-BE01E91C7861}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
			
		||||
		{6F70D808-2CB4-4844-B72C-BE01E91C7861}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
			
		||||
		{6F70D808-2CB4-4844-B72C-BE01E91C7861}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
			
		||||
		{6F70D808-2CB4-4844-B72C-BE01E91C7861}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
			
		||||
		{DDC87725-25E6-44C9-ABAC-C93FF4171F4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
			
		||||
		{DDC87725-25E6-44C9-ABAC-C93FF4171F4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
			
		||||
		{DDC87725-25E6-44C9-ABAC-C93FF4171F4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
			
		||||
		{DDC87725-25E6-44C9-ABAC-C93FF4171F4B}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
			
		||||
		{99F5300F-E8A1-497A-835D-813890F4EA8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 | 
			
		||||
		{99F5300F-E8A1-497A-835D-813890F4EA8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
 | 
			
		||||
		{99F5300F-E8A1-497A-835D-813890F4EA8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
 | 
			
		||||
		{99F5300F-E8A1-497A-835D-813890F4EA8A}.Release|Any CPU.Build.0 = Release|Any CPU
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(SolutionProperties) = preSolution
 | 
			
		||||
		HideSolutionNode = FALSE
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(NestedProjects) = preSolution
 | 
			
		||||
		{6F70D808-2CB4-4844-B72C-BE01E91C7861} = {6EFC1819-8C82-49C6-B893-B84E8C218560}
 | 
			
		||||
		{DDC87725-25E6-44C9-ABAC-C93FF4171F4B} = {6EFC1819-8C82-49C6-B893-B84E8C218560}
 | 
			
		||||
		{99F5300F-E8A1-497A-835D-813890F4EA8A} = {6EFC1819-8C82-49C6-B893-B84E8C218560}
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
	GlobalSection(ExtensibilityGlobals) = postSolution
 | 
			
		||||
		SolutionGuid = {1EC384B4-F27F-4F71-8BDC-16F7BA8689E9}
 | 
			
		||||
	EndGlobalSection
 | 
			
		||||
EndGlobal
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user