refactor: Projektdateien migriert. Cloud-NuGet-Pakete durch lokale NuGet-Projekte ersetzt.
This commit is contained in:
25
Scripts/Core/EntityController_test.tmpl
Normal file
25
Scripts/Core/EntityController_test.tmpl
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
[Fact]
|
||||
public async Task Check_Get_entity_Controller()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
int entityId = 1;
|
||||
_entity_Repository repository = new _entity_Repository();
|
||||
_entity_Controller controller = new _entity_Controller(repository);
|
||||
dynamic result = await controller.GetEntityAsync(entityId);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.Result.StatusCode);
|
||||
|
||||
var entity = result.Result.Value;
|
||||
Assert.NotNull(entity);
|
||||
if (entityId > 0) Assert.Equal(entityId, entity._entity_Id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
27
Scripts/Core/EntityFilteredListController_test.tmpl
Normal file
27
Scripts/Core/EntityFilteredListController_test.tmpl
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
[Fact]
|
||||
public async Task Check_Get_entity_FilteredListController()
|
||||
{
|
||||
Shared_Test_Config.Init_Webapi_Context();
|
||||
|
||||
try
|
||||
{
|
||||
_filter_Filter filter = new _filter_Filter();
|
||||
filter.Name = "";
|
||||
_entity_Repository repository = new _entity_Repository();
|
||||
_entity_Controller controller = new _entity_Controller(repository);
|
||||
dynamic result = await controller.Get_entity_ListAsync(filter);
|
||||
Assert.NotNull(result);
|
||||
Assert.Equal(StatusCodes.Status200OK, result.StatusCode);
|
||||
|
||||
var entity = result.Value;
|
||||
Assert.NotNull(entity);
|
||||
|
||||
Assert.NotEqual(entity.Count, 0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
54
Scripts/Core/add_CommonTestController.bat
Normal file
54
Scripts/Core/add_CommonTestController.bat
Normal file
@@ -0,0 +1,54 @@
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set InputFile=%2
|
||||
set OutputFile=%InputFile%#
|
||||
set entity=%1
|
||||
set "_strFind=Check_Dynamic_EntityControllers"
|
||||
set _strInsert1=[InlineData("%entity%")]
|
||||
set "_strInsert1= %_strInsert1%"
|
||||
|
||||
rem if already inserted, do nothing
|
||||
:Check
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strInsert1%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
if "!_line!" neq "!line!" goto finish
|
||||
endlocal
|
||||
)
|
||||
@echo off
|
||||
|
||||
:Replace
|
||||
>"%OutputFile%" (
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strFind%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
|
||||
|
||||
if "!_line!" neq "!line!" (
|
||||
echo !_strInsert1!
|
||||
)
|
||||
echo.!line!
|
||||
endlocal
|
||||
)
|
||||
)
|
||||
|
||||
del %InputFile%>nul
|
||||
copy %OutputFile% %InputFile%>nul
|
||||
del %OutputFile%>nul
|
||||
|
||||
:finish
|
||||
61
Scripts/Core/add_ServiceExtensions.bat
Normal file
61
Scripts/Core/add_ServiceExtensions.bat
Normal file
@@ -0,0 +1,61 @@
|
||||
@echo off
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set InputFile=%2
|
||||
set OutputFile=%InputFile%#
|
||||
set entity=%1
|
||||
set "_strFind=ConfigureRepositoryWrapper(this IServiceCollection services)"
|
||||
set "_strInsert1= services.AddScoped(typeof(IBaseRepository<%entity%>), typeof(%entity%Repository));"
|
||||
set doreplace=0
|
||||
|
||||
rem if already inserted, do nothing
|
||||
:Check
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strInsert1%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
if "!_line!" neq "!line!" goto finish
|
||||
endlocal
|
||||
)
|
||||
|
||||
:Replace
|
||||
>"%OutputFile%" (
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strFind%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
|
||||
|
||||
if "!_line!" neq "!line!" (
|
||||
echo.!line!
|
||||
endlocal
|
||||
set doreplace=1
|
||||
) else (
|
||||
echo.!line!
|
||||
if !doreplace!==1 (
|
||||
echo !_strInsert1!
|
||||
)
|
||||
endlocal
|
||||
set doreplace=0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
del %InputFile%
|
||||
copy %OutputFile% %InputFile%>nul
|
||||
del %OutputFile%
|
||||
|
||||
:finish
|
||||
69
Scripts/Core/add_WebApiContext.bat
Normal file
69
Scripts/Core/add_WebApiContext.bat
Normal file
@@ -0,0 +1,69 @@
|
||||
@echo off
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set InputFile=%2
|
||||
set OutputFile=%InputFile%#
|
||||
set entity=%1
|
||||
set "_strFind=OnModelCreating(ModelBuilder modelBuilder)"
|
||||
set "_strInsert1= public virtual DbSet<%entity%> %entity%Set { get; set; }"
|
||||
set "_strInsert2= modelBuilder.Entity<%entity%>(entity =>"
|
||||
set "_strInsert3= {"
|
||||
set "_strInsert4= entity.ToView("%entity%", "webapi");"
|
||||
set "_strInsert5= });"
|
||||
set doreplace=0
|
||||
|
||||
rem if already inserted, do nothing
|
||||
:Check
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strInsert1%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
if "!_line!" neq "!line!" goto finish
|
||||
endlocal
|
||||
)
|
||||
|
||||
:Replace
|
||||
>"%OutputFile%" (
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strFind%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
|
||||
|
||||
if "!_line!" neq "!line!" (
|
||||
echo !_strInsert1!
|
||||
echo.!line!
|
||||
endlocal
|
||||
set doreplace=1
|
||||
) else (
|
||||
echo.!line!
|
||||
if !doreplace!==1 (
|
||||
echo !_strInsert2!
|
||||
echo !_strInsert3!
|
||||
echo !_strInsert4!
|
||||
echo !_strInsert5!
|
||||
echo.
|
||||
)
|
||||
endlocal
|
||||
set doreplace=0
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
del %InputFile%
|
||||
copy %OutputFile% %InputFile%>nul
|
||||
del %OutputFile%
|
||||
:finish
|
||||
15
Scripts/Core/add_controller.bat
Normal file
15
Scripts/Core/add_controller.bat
Normal file
@@ -0,0 +1,15 @@
|
||||
@echo using HRD.LDAPService.JWT;
|
||||
@echo using HRD.WebApi.Controllers;
|
||||
@echo using HRD.WebApi.Repositories;
|
||||
@echo using DAL.Models.Entities;
|
||||
@echo.
|
||||
@echo namespace %2Server.Controllers
|
||||
@echo {
|
||||
@echo [JWTAuthorize]
|
||||
@echo public class %1Controller : BaseController^<%1^>
|
||||
@echo {
|
||||
@echo public %1Controller(IBaseRepository^<%1^> repositoryBase) : base(repositoryBase)
|
||||
@echo {
|
||||
@echo }
|
||||
@echo }
|
||||
@echo }
|
||||
36
Scripts/Core/add_controller_filter.bat
Normal file
36
Scripts/Core/add_controller_filter.bat
Normal file
@@ -0,0 +1,36 @@
|
||||
@echo using System;
|
||||
@echo using System.Threading.Tasks;
|
||||
@echo using Microsoft.AspNetCore.Mvc;
|
||||
@echo using Microsoft.AspNetCore.Http;
|
||||
@echo using HRD.LDAPService.JWT;
|
||||
@echo using HRD.WebApi.Controllers;
|
||||
@echo using HRD.WebApi.Repositories;
|
||||
@echo using DAL.Repositories;
|
||||
@echo using DAL.Models.Entities;
|
||||
@echo using DAL.Models.Filters;
|
||||
@echo.
|
||||
@echo namespace %2Server.Controllers
|
||||
@echo {
|
||||
@echo [JWTAuthorize]
|
||||
@echo public class %1Controller : BaseController^<%1^>
|
||||
@echo {
|
||||
@echo public %1Controller(IBaseRepository^<%1^> repositoryBase) : base(repositoryBase)
|
||||
@echo {
|
||||
@echo }
|
||||
@echo.
|
||||
@echo [HttpPost("%3Filter")]
|
||||
@echo public async Task^<IActionResult^> Get%1ListAsync([FromBody] %3Filter filter)
|
||||
@echo {
|
||||
@echo try
|
||||
@echo {
|
||||
@echo var list = await ((%1Repository)EntityRepository).GetListByFilterAsync(filter);
|
||||
@echo return new OkObjectResult(list);
|
||||
@echo }
|
||||
@echo catch (Exception ex)
|
||||
@echo {
|
||||
@echo this.WriteLogException(ex);
|
||||
@echo return StatusCode(StatusCodes.Status400BadRequest, $"Cann't get the filtered list of {typeof(%1).Name}");
|
||||
@echo }
|
||||
@echo }
|
||||
@echo }
|
||||
@echo }
|
||||
23
Scripts/Core/add_entity.bat
Normal file
23
Scripts/Core/add_entity.bat
Normal file
@@ -0,0 +1,23 @@
|
||||
@echo using HRD.WebApi.DAL;
|
||||
@echo using System;
|
||||
@echo using System.ComponentModel.DataAnnotations.Schema;
|
||||
@echo.
|
||||
@echo namespace DAL.Models.Entities
|
||||
@echo {
|
||||
@echo public partial class %1 : BaseEntity
|
||||
@echo {
|
||||
@echo public int %1Id { get; set; }
|
||||
@echo public string Name { get; set; }
|
||||
@echo public string %1Shortname { get; set; }
|
||||
@echo.
|
||||
@echo // [NotMapped]
|
||||
@echo // [DatabaseGenerated(DatabaseGeneratedOption.Computed)]
|
||||
@echo.
|
||||
@echo //generic Id
|
||||
@echo public override int GetEntityId() =^> %1Id;
|
||||
@echo //generic ToString()
|
||||
@echo public override string ToString() =^> $"%1Id: {GetEntityId()}; Name: {Name}";
|
||||
@echo //generic EntityInfo()
|
||||
@echo public override string EntityInfo() =^> base.EntityInfo();
|
||||
@echo }
|
||||
@echo }
|
||||
11
Scripts/Core/add_filter.bat
Normal file
11
Scripts/Core/add_filter.bat
Normal file
@@ -0,0 +1,11 @@
|
||||
@echo using HRD.WebApi.DAL;
|
||||
@echo.
|
||||
@echo namespace DAL.Models.Filters
|
||||
@echo {
|
||||
@echo public partial class %1Filter : BaseFilter
|
||||
@echo {
|
||||
@echo public int? %1Id { get; set; }
|
||||
@echo public string Name { get; set; }
|
||||
@echo public int[] ListIds { get; set; }
|
||||
@echo }
|
||||
@echo }
|
||||
12
Scripts/Core/add_repository.bat
Normal file
12
Scripts/Core/add_repository.bat
Normal file
@@ -0,0 +1,12 @@
|
||||
@echo using HRD.WebApi.Repositories;
|
||||
@echo using DAL.Models.Entities;
|
||||
@echo.
|
||||
@echo namespace DAL.Repositories
|
||||
@echo {
|
||||
@echo public class %1Repository : BaseRepository^<%1^>
|
||||
@echo {
|
||||
@echo public %1Repository() : base(new WebApiContext())
|
||||
@echo {
|
||||
@echo }
|
||||
@echo }
|
||||
@echo }
|
||||
51
Scripts/Core/add_repository_filter.bat
Normal file
51
Scripts/Core/add_repository_filter.bat
Normal file
@@ -0,0 +1,51 @@
|
||||
@echo using System.Collections.Generic;
|
||||
@echo using System.Linq;
|
||||
@echo using System.Threading.Tasks;
|
||||
@echo using Microsoft.EntityFrameworkCore;
|
||||
@echo using HRD.WebApi.Repositories;
|
||||
@echo using DAL.Models.Entities;
|
||||
@echo using DAL.Models.Filters;
|
||||
@echo.
|
||||
@echo namespace DAL.Repositories
|
||||
@echo {
|
||||
@echo public class %1Repository: BaseRepository^<%1^>
|
||||
@echo {
|
||||
@echo public %1Repository() : base(new WebApiContext())
|
||||
@echo {
|
||||
@echo }
|
||||
@echo.
|
||||
@echo public async Task^<List^<%1^>^> GetListByFilterAsync(%2Filter filter, bool asNoTracking = true)
|
||||
@echo {
|
||||
@echo var items = this.RepositoryContext.Set^<%1^>().AsQueryable();
|
||||
@echo.
|
||||
@echo if (filter.%2Id != null ^&^& filter.%2Id != 0)
|
||||
@echo {
|
||||
@echo items = items.Where(x =^> x.%1Id == filter.%2Id);
|
||||
@echo return asNoTracking ? await items.ToListAsync() : await items.ToListAsync();
|
||||
@echo }
|
||||
@echo.
|
||||
@echo /*
|
||||
@echo // gets entity x if x.FirstName or x.LastName contains filter.Name, case independent
|
||||
@echo if (!string.IsNullOrEmpty(filter.Name))
|
||||
@echo {
|
||||
@echo items = items.Where(x =^> EF.Functions.Like(x.FirstName.ToLower()+' '+ x.LastName.ToLower(), $"%%{filter.Name.ToLower()}%%"));
|
||||
@echo }
|
||||
@echo.
|
||||
@echo // N:N - filter: gets entity x where one of Id in x.IdList (comma separated list of ids) is infilter.ListIds (array of Ids from Hensel-Selection multiselect Component)
|
||||
@echo if (filter.ListIds != null ^&^& filter.ListIds.Length ^> 0)
|
||||
@echo {
|
||||
@echo IQueryable^<%1^> itemsTmp = null;
|
||||
@echo for (int i = 0; i^< filter.ListIds.Length; i++)
|
||||
@echo {
|
||||
@echo var inx = filter.ListIds[i];
|
||||
@echo var items_ = items.Where(x =^> EF.Functions.Like("," + x.IdList.Replace(" ", "") + ",", $"%%,{inx},%%"));
|
||||
@echo itemsTmp = (itemsTmp != null) ? itemsTmp.Concat(items_) : items_;
|
||||
@echo }
|
||||
@echo items = itemsTmp;
|
||||
@echo }
|
||||
@echo */
|
||||
@echo.
|
||||
@echo return asNoTracking ? await items.AsNoTracking().ToListAsync() : await items.ToListAsync();
|
||||
@echo }
|
||||
@echo }
|
||||
@echo }
|
||||
20
Scripts/Core/add_test_project.bat
Normal file
20
Scripts/Core/add_test_project.bat
Normal file
@@ -0,0 +1,20 @@
|
||||
@echo off
|
||||
echo ^<Project Sdk="Microsoft.NET.Sdk"^>
|
||||
echo.
|
||||
echo ^<PropertyGroup^>
|
||||
echo ^<TargetFramework^>netcoreapp3.1^</TargetFramework^>
|
||||
echo.
|
||||
echo ^<IsPackable^>false^</IsPackable^>
|
||||
echo ^</PropertyGroup^>
|
||||
echo.
|
||||
echo ^<ItemGroup^>
|
||||
echo ^<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" /^>
|
||||
echo ^<PackageReference Include="xunit" Version="2.4.0" /^>
|
||||
echo ^<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /^>
|
||||
echo ^<PackageReference Include="coverlet.collector" Version="1.2.0" /^>
|
||||
echo ^</ItemGroup^>
|
||||
echo.
|
||||
echo ^<ItemGroup^>
|
||||
echo ^<ProjectReference Include="..\%1Server\%1Server.csproj" /^>
|
||||
echo ^</ItemGroup^>
|
||||
echo ^</Project^>
|
||||
65
Scripts/Core/add_tests_generic.bat
Normal file
65
Scripts/Core/add_tests_generic.bat
Normal file
@@ -0,0 +1,65 @@
|
||||
@echo off
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set InputFile=%2
|
||||
set OutputFile=%InputFile%#
|
||||
set entity=%1
|
||||
set filtername=%4
|
||||
set "_strFind=//----Check_GetEntity%3"
|
||||
set "_strInsert1= public async Task Check_Get%entity%%3()"
|
||||
set "scripts_path=%~dp0..\Core"
|
||||
set templatefile_path=%scripts_path%\Entity%3_test.tmpl
|
||||
|
||||
|
||||
rem if already inserted, do nothing
|
||||
:Check
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strInsert1%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
if "!_line!" neq "!line!" goto finish
|
||||
endlocal
|
||||
)
|
||||
|
||||
call %scripts_path%\replaceinfile.bat %templatefile_path% _entity_ %entity% dontdelete>nul
|
||||
if "%filtername%" neq "" (
|
||||
call %scripts_path%\replaceinfile.bat %templatefile_path%# _filter_ %filtername% dontdelete>nul
|
||||
del %templatefile_path%# >nul
|
||||
copy %templatefile_path%## %templatefile_path%# >nul
|
||||
del %templatefile_path%## >nul
|
||||
)
|
||||
|
||||
:Replace
|
||||
>"%OutputFile%" (
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strFind%=!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
|
||||
|
||||
echo.!line!
|
||||
if "!_line!" neq "!line!" (
|
||||
type %templatefile_path%#
|
||||
)
|
||||
endlocal
|
||||
)
|
||||
)
|
||||
|
||||
del %templatefile_path%# >nul
|
||||
del %InputFile% >nul
|
||||
copy %OutputFile% %InputFile% >nul
|
||||
del %OutputFile% >nul
|
||||
:finish
|
||||
33
Scripts/Core/replaceinfile.bat
Normal file
33
Scripts/Core/replaceinfile.bat
Normal file
@@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set InputFile=%1
|
||||
set OutputFile=%InputFile%#
|
||||
set "_strFind=%2"
|
||||
set "_strInsert=%3"
|
||||
set "_withoutdelete=%4"
|
||||
|
||||
:Replace
|
||||
>"%OutputFile%" (
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%InputFile%"') do (
|
||||
set "line=%%L"
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" (
|
||||
set "_line=!line:%_strFind%=%_strInsert%!"
|
||||
) else (
|
||||
set _line=!line!
|
||||
)
|
||||
|
||||
echo.!_line!
|
||||
endlocal
|
||||
)
|
||||
)
|
||||
|
||||
if "%_withoutdelete%"=="" (
|
||||
del %InputFile%
|
||||
copy %OutputFile% %InputFile%>nul
|
||||
del %OutputFile%
|
||||
)
|
||||
10
Scripts/Core/sample_entity.bat
Normal file
10
Scripts/Core/sample_entity.bat
Normal file
@@ -0,0 +1,10 @@
|
||||
@echo set Project=%1
|
||||
@echo set NewEntity=1
|
||||
@echo set Entityname=
|
||||
@echo set Filter4Entity=
|
||||
@echo @@if "%%NewEntity%%"=="" exit
|
||||
@echo call ..\Core\start_add_entity_to_project.bat %%Project%% %%EntityName%% %%Filter4Entity%%
|
||||
|
||||
|
||||
|
||||
|
||||
45
Scripts/Core/start_add_entity_to_project.bat
Normal file
45
Scripts/Core/start_add_entity_to_project.bat
Normal file
@@ -0,0 +1,45 @@
|
||||
@echo off
|
||||
set project_name=%1
|
||||
set entity=%2
|
||||
set filter_name=%3
|
||||
set "project_path=%~dp0..\.."
|
||||
set "scripts_path=%~dp0..\Core"
|
||||
set entity_path=%project_path%\DAL\Models\Entities
|
||||
set filter_path=%project_path%\DAL\Models\Filters
|
||||
set repository_path=%project_path%\DAL\Repositories
|
||||
set controller_path=%project_path%\%project_name%Server\Controllers
|
||||
set webapicontext_path=%project_path%\DAL\WebApiContext.cs
|
||||
set serviceExtensions_path=%project_path%\%project_name%Server\Extends\ServiceExtensions4BaseRepository.cs
|
||||
set controllertestgeneric_path=%project_path%\XUnitDAL.Test\_Shared\Shared_Test_Controller_Generic.cs
|
||||
set controllertestentity_path=%project_path%\XUnitDAL.Test\Test_Controller_Entity.cs
|
||||
set controllertestfilter_path=%project_path%\XUnitDAL.Test\Test_Controller_Filter.cs
|
||||
|
||||
if not exist "%entity_path%" mkdir "%entity_path%"
|
||||
if not exist "%filter_path%" mkdir "%filter_path%"
|
||||
if not exist "%repository_path%" mkdir "%repository_path%"
|
||||
if not exist "%controller_path%" mkdir "%controller_path%"
|
||||
|
||||
IF "%filter_name%"=="" (
|
||||
call %scripts_path%\add_repository.bat %entity% >"%repository_path%"\%entity%Repository.cs
|
||||
call %scripts_path%\add_controller.bat %entity% %project_name% >"%controller_path%"\%entity%Controller.cs
|
||||
) ELSE (
|
||||
if not exist "%filter_path%"\%filter_name%Filter.cs call %scripts_path%\add_filter.bat %filter_name% >"%filter_path%"\%filter_name%Filter.cs
|
||||
call %scripts_path%\add_repository_filter.bat %entity% %filter_name% >"%repository_path%"\%entity%Repository.cs
|
||||
call %scripts_path%\add_controller_filter.bat %entity% %project_name% %filter_name% >"%controller_path%"\%entity%Controller.cs
|
||||
)
|
||||
|
||||
call %scripts_path%\add_entity.bat %entity% >"%entity_path%"\%entity%.cs
|
||||
call %scripts_path%\add_WebApiContext.bat %entity% "%webapicontext_path%"
|
||||
call %scripts_path%\add_serviceExtensions.bat %entity% "%ServiceExtensions_path%"
|
||||
|
||||
if exist "%controllertestgeneric_path%" call %scripts_path%\add_CommonTestController.bat %entity% %controllertestgeneric_path%
|
||||
if exist "%controllertestentity_path%" call %scripts_path%\add_tests_generic.bat %entity% %controllertestentity_path% Controller
|
||||
if exist "%controllertestfilter_path%" (
|
||||
IF "%filter_name%" neq "" call %scripts_path%\add_tests_generic.bat %entity% %controllertestfilter_path% FilteredListController %filter_name%
|
||||
)
|
||||
|
||||
echo --finished: %2
|
||||
|
||||
|
||||
|
||||
|
||||
17
Scripts/Run/EntitiesFilterList.lst
Normal file
17
Scripts/Run/EntitiesFilterList.lst
Normal file
@@ -0,0 +1,17 @@
|
||||
DepartmentToWebAppToEmployeeForWindream Employee
|
||||
DocumentArtToDepartment Department
|
||||
Employee EmployeeFull
|
||||
EmployeeToAttribute Employee
|
||||
EmployeeToDepartment Employee
|
||||
EmployeeToWebApp Employee
|
||||
WebAppAdditionalRole WebApp
|
||||
WebAppToDepartment EmployeeToWebApp
|
||||
WebAppToWebAppAdditionalRole EmployeeToWebApp
|
||||
WebAppToWebAppRole WebApp
|
||||
WindreamColumnsToDepartment Department
|
||||
WindreamIndex ClientId
|
||||
WindreamIndexToWindreamSearchToDepartment WindreamSearchToDepartment
|
||||
WindreamSearch ClientId
|
||||
WindreamSearchItem ClientId
|
||||
WindreamSearchItemToWindreamSearchToDepartment WindreamSearchToDepartment
|
||||
WindreamSearchToDepartment Department
|
||||
10
Scripts/Run/EntitiesList.lst
Normal file
10
Scripts/Run/EntitiesList.lst
Normal file
@@ -0,0 +1,10 @@
|
||||
AdWebAppToWebAppRole
|
||||
CostCentre
|
||||
Department
|
||||
DocumentArt
|
||||
EmployeeAttribute
|
||||
EmployeeStatus
|
||||
Project
|
||||
Rang
|
||||
WebApp
|
||||
WebAppRole
|
||||
27
Scripts/Run/add_list_entities.bat
Normal file
27
Scripts/Run/add_list_entities.bat
Normal file
@@ -0,0 +1,27 @@
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB AdWebAppToWebAppRole
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB CostCentre
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB Department
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB DocumentArt
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB EmployeeAttribute
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB EmployeeStatus
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB Project
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB Rang
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebApp
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebAppRole
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB DepartmentToWebAppToEmployeeForWindream Employee
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB DocumentArtToDepartment Department
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB Employee EmployeeFull
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB EmployeeToAttribute Employee
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB EmployeeToDepartment Employee
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB EmployeeToWebApp Employee
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebAppAdditionalRole WebApp
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebAppToDepartment EmployeeToWebApp
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebAppToWebAppAdditionalRole EmployeeToWebApp
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WebAppToWebAppRole WebApp
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamColumnsToDepartment Department
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamIndex ClientId
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamIndexToWindreamSearchToDepartment WindreamSearchToDepartment
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamSearch ClientId
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamSearchItem ClientId
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamSearchItemToWindreamSearchToDepartment WindreamSearchToDepartment
|
||||
call ..\Core\start_add_entity_to_project.bat StaffDB WindreamSearchToDepartment Department
|
||||
6
Scripts/Run/add_one_entity.bat
Normal file
6
Scripts/Run/add_one_entity.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
set Project=StaffDB
|
||||
set NewEntity=1
|
||||
set Entityname=Subsidiary
|
||||
set Filter4Entity=
|
||||
@@if "%NewEntity%"=="" exit
|
||||
call ..\Core\start_add_entity_to_project.bat %Project% %EntityName% %Filter4Entity%
|
||||
73
Scripts/Run/prepare_project.bat
Normal file
73
Scripts/Run/prepare_project.bat
Normal file
@@ -0,0 +1,73 @@
|
||||
@echo off
|
||||
setlocal disableDelayedExpansion
|
||||
|
||||
:Variables
|
||||
set "work_project=%1"
|
||||
set template_project=Empty
|
||||
set entities_list=EntitiesList.lst
|
||||
set entities_filter_list=EntitiesFilterList.lst
|
||||
set "project_path=%~dp0..\.."
|
||||
|
||||
if "%work_project%"=="" exit
|
||||
ren %project_path%\%template_project%Server\%template_project%Server.csproj %work_project%Server.csproj
|
||||
ren %project_path%\%template_project%Server.sln %work_project%Server.sln
|
||||
ren %project_path%\%template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\add_test_project.bat %work_project% >..\..\XUnitDAL.Test\XUnitWebApi.Test.csproj
|
||||
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server.sln %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Program.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Startup.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedControllers\InfoController.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedControllers\WebAppUserController.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedControllers\WebAppUserHelper.cs %template_project%Server %work_project%Server
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedExtensions\ServiceExtensions.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedExtensions\ServiceSwaggerExtensions.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\_Shared\SharedExtensions\WebApiMiddlewareOptionsHelper.cs %template_project%Server %work_project%Server
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Extends\ServiceExtensions4BaseRepository.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Extends\JwtMiddlewareOptionsHelper.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Extends\JwtMiddlewareOptionsHelper.cs %template_project% %work_project%
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\Properties\launchSettings.json %template_project%Server %work_project%Server
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\XUnitWebApi.Test.csproj %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\_Shared\Shared_Test_Controller_Generic.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\_Shared\Shared_Test_LDAP.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\_Shared\shared_test_config.cs %template_project% %work_project%
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\Test_Controller_Entity.cs %template_project%Server %work_project%Server
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\XUnitDAL.Test\Test_Controller_Filter.cs %template_project%Server %work_project%Server
|
||||
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\appsettings.json %template_project% %work_project%
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\AppsettingsFiles\Production\appsettings.json %template_project% %work_project%
|
||||
call %~dp0..\Core\replaceinfile.bat %project_path%\%work_project%Server\AppsettingsFiles\Develop\appsettings.json %template_project% %work_project%
|
||||
:Prepare_batch_files
|
||||
call %~dp0..\Core\sample_entity.bat %work_project% >add_one_entity.bat
|
||||
if exist add_list_entities.bat del add_list_entities.bat
|
||||
|
||||
:Prepare_batch_for_entities
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%entities_list%"') do (
|
||||
set "line=%%L"
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
set "line=!line:*:=!"
|
||||
if "!line!" neq "" echo call ..\Core\start_add_entity_to_project.bat %work_project% !line! >> add_list_entities.bat
|
||||
endlocal
|
||||
)
|
||||
|
||||
:Prepare_batch_for_entities_with_filter
|
||||
for /F "delims=" %%L in ('findstr /n "^" "%entities_filter_list%"') do (
|
||||
set "line=%%L"
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
set "line=!line:*:=!"
|
||||
set "entity_filter="
|
||||
set "entity="
|
||||
for /f "tokens=1,2 delims= " %%a in ("!line!") do set entity=%%a& set entity_filter=%%b
|
||||
if "!entity_filter!"=="" set entity_filter=!line!
|
||||
if "!entity!" neq "" echo call ..\Core\start_add_entity_to_project.bat %work_project% !entity! !entity_filter! >> add_list_entities.bat
|
||||
endlocal
|
||||
)
|
||||
|
||||
if exist add_list_entities.bat call add_list_entities.bat
|
||||
Reference in New Issue
Block a user