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>
<TargetFramework>net6.0</TargetFramework>
<LangVersion>10</LangVersion>
<RootNamespace>BlueWest.WebApi</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.41.0" />
<PackageReference Include="Grpc.AspNetCore.Server" 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.Swagger" Version="6.2.3" />
</ItemGroup>

View File

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

View File

@ -41,7 +41,7 @@ namespace BlueWest.WebApi
});
});
services.AddControllers().AddNewtonsoftJson();
services.AddControllers();
/*services
.AddNewtonsoftJson(options =>
options.SerializerSettings.Converters.Add(new StringEnumConverter()));
@ -53,7 +53,7 @@ namespace BlueWest.WebApi
options.SchemaFilter<SwaggerEnumSchemaFilter>();
options.SwaggerDoc("v1", new OpenApiInfo
{
Title = "BlueWest.WebApi",
Title = "BlueWest.Api",
Version = "v1"
});
});
@ -68,7 +68,7 @@ namespace BlueWest.WebApi
{
app.UseDeveloperExceptionPage();
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();

View File

@ -21,7 +21,7 @@ namespace BlueWest.Data
[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;
Name = name;

View File

@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest", "BlueWest\BlueWe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Data", "BlueWest.Data\BlueWest.Data.csproj", "{E518C62D-768C-4885-9C9D-FD5761605B54}"
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
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlueWest.Collections", "BlueWest.Collections\BlueWest.Collections.csproj", "{F55019A2-E2A8-4AF1-8FBC-FA99476A1B1C}"
EndProject

View File

@ -40,14 +40,12 @@ namespace PerformanceSolution.Data
}
public static FinanceTransaction GetTransactionById(int userId, int transactionId) => UserList.GetTransactionById(userId, transactionId);
private static void SaveUserList() => SaveUserList(UserList);
public static User AddOrModifyUser(UserUpdateDto userUpdateDto, int userId = -1)
{
return UserList.AddUser(userId, userUpdateDto);
}
private static UserList GenerateMockData()
@ -56,7 +54,7 @@ namespace PerformanceSolution.Data
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 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));

View File

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