Remove Newtonsoft and add MySQL EF package

This commit is contained in:
CodeLiturgy 2022-08-04 00:35:01 +01:00
parent a8e740f4fd
commit 9e61c50958
16 changed files with 9 additions and 21 deletions

View File

@ -3,13 +3,14 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion> <LangVersion>10</LangVersion>
<RootNamespace>BlueWest.WebApi</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.41.0" /> <PackageReference Include="Grpc.AspNetCore" Version="2.41.0" />
<PackageReference Include="Grpc.AspNetCore.Server" Version="2.41.0" /> <PackageReference Include="Grpc.AspNetCore.Server" Version="2.41.0" />
<PackageReference Include="Grpc.AspNetCore.Web" Version="2.41.0" /> <PackageReference Include="Grpc.AspNetCore.Web" Version="2.41.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.12" /> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.2.3" /> <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.2.3" />
</ItemGroup> </ItemGroup>

View File

@ -21,7 +21,6 @@ namespace BlueWest.WebApi.Controllers
if (_userList != null) if (_userList != null)
{ {
return Ok(_userList.Users.Values.ToImmutableArray()); return Ok(_userList.Users.Values.ToImmutableArray());
} }
return new NotFoundResult(); return new NotFoundResult();

View File

@ -41,7 +41,7 @@ namespace BlueWest.WebApi
}); });
}); });
services.AddControllers().AddNewtonsoftJson(); services.AddControllers();
/*services /*services
.AddNewtonsoftJson(options => .AddNewtonsoftJson(options =>
options.SerializerSettings.Converters.Add(new StringEnumConverter())); options.SerializerSettings.Converters.Add(new StringEnumConverter()));
@ -53,7 +53,7 @@ namespace BlueWest.WebApi
options.SchemaFilter<SwaggerEnumSchemaFilter>(); options.SchemaFilter<SwaggerEnumSchemaFilter>();
options.SwaggerDoc("v1", new OpenApiInfo options.SwaggerDoc("v1", new OpenApiInfo
{ {
Title = "BlueWest.WebApi", Title = "BlueWest.Api",
Version = "v1" Version = "v1"
}); });
}); });
@ -68,7 +68,7 @@ namespace BlueWest.WebApi
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BlueWest.WebApi v1")); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "BlueWest.Api v1"));
} }
app.UseHttpsRedirection(); app.UseHttpsRedirection();

View File

@ -21,7 +21,7 @@ namespace BlueWest.Data
[Key(8)] public FastDictionary<int, FinanceTransaction> FinanceTransactions { get; } [Key(8)] public FastDictionary<int, FinanceTransaction> FinanceTransactions { get; }
public User(TimeSpan id, string name, string address, string btcAddress, string ltcAddress, double btcAmount, double ltcAmount, FastDictionary<int, FinanceTransaction> financeTransactions) public User(TimeSpan id, string name, FastDictionary<int, FinanceTransaction> financeTransactions)
{ {
Id = id; Id = id;
Name = name; Name = name;

View File

@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest", "BlueWest\BlueWe
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Data", "BlueWest.Data\BlueWest.Data.csproj", "{E518C62D-768C-4885-9C9D-FD5761605B54}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Data", "BlueWest.Data\BlueWest.Data.csproj", "{E518C62D-768C-4885-9C9D-FD5761605B54}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.WebApi", "BlueWest.WebApi\BlueWest.WebApi.csproj", "{6D3321B5-CF1A-4251-B28D-329EDA6DC278}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Api", "BlueWest.Api\BlueWest.Api.csproj", "{6D3321B5-CF1A-4251-B28D-329EDA6DC278}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Collections", "BlueWest.Collections\BlueWest.Collections.csproj", "{F55019A2-E2A8-4AF1-8FBC-FA99476A1B1C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Collections", "BlueWest.Collections\BlueWest.Collections.csproj", "{F55019A2-E2A8-4AF1-8FBC-FA99476A1B1C}"
EndProject EndProject

View File

@ -41,13 +41,11 @@ namespace PerformanceSolution.Data
public static FinanceTransaction GetTransactionById(int userId, int transactionId) => UserList.GetTransactionById(userId, transactionId); public static FinanceTransaction GetTransactionById(int userId, int transactionId) => UserList.GetTransactionById(userId, transactionId);
private static void SaveUserList() => SaveUserList(UserList); private static void SaveUserList() => SaveUserList(UserList);
public static User AddOrModifyUser(UserUpdateDto userUpdateDto, int userId = -1) public static User AddOrModifyUser(UserUpdateDto userUpdateDto, int userId = -1)
{ {
return UserList.AddUser(userId, userUpdateDto); return UserList.AddUser(userId, userUpdateDto);
} }
private static UserList GenerateMockData() private static UserList GenerateMockData()
@ -56,7 +54,7 @@ namespace PerformanceSolution.Data
var transactions = new FastDictionary<int, FinanceTransaction>(); var transactions = new FastDictionary<int, FinanceTransaction>();
var u = new User(DateTime.Now.TimeOfDay, "Rui Sousa", "Sagres", "NOADD", "NOADD", 0, 0, transactions); var u = new User(DateTime.Now.TimeOfDay, "Benny", transactions);
var list = new FastDictionary<int, User>(10); var list = new FastDictionary<int, User>(10);
var financeTransaction = new FinanceTransaction(TimeSpan.FromTicks(DateTime.Now.Ticks), u.Id, "", 0.00, 0.00, 0.00, var financeTransaction = new FinanceTransaction(TimeSpan.FromTicks(DateTime.Now.Ticks), u.Id, "", 0.00, 0.00, 0.00,
TimeSpan.FromTicks(DateTime.Now.Ticks), TimeSpan.FromTicks(DateTime.Now.Ticks)); TimeSpan.FromTicks(DateTime.Now.Ticks), TimeSpan.FromTicks(DateTime.Now.Ticks));

View File

@ -1,10 +0,0 @@
using BlueWest.Core;
class Program
{
public static void Main()
{
new BlueProgram().Run();
}
}