-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure-Samples#36 from Azure-Samples/addcache
Addcache
- Loading branch information
Showing
79 changed files
with
53,758 additions
and
18,949 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Http.Extensions; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
|
||
namespace DotNetCoreSqlDb | ||
{ | ||
public class ActionTimerFilterAttribute : ActionFilterAttribute | ||
{ | ||
readonly Stopwatch _stopwatch = new Stopwatch(); | ||
|
||
public override void OnActionExecuting(ActionExecutingContext context) => _stopwatch.Start(); | ||
|
||
public override void OnActionExecuted(ActionExecutedContext context) | ||
{ | ||
_stopwatch.Stop(); | ||
if (context.Result is ViewResult) | ||
{ | ||
((ViewResult)context.Result).ViewData["TimeElapsed"] = _stopwatch.Elapsed; | ||
} | ||
_stopwatch.Reset(); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
|
||
namespace DotNetCoreSqlDb.Data | ||
{ | ||
public static class ConvertData<T> | ||
{ | ||
public static List<T> ByteArrayToObjectList(byte[] inputByteArray) | ||
{ | ||
var deserializedList = JsonSerializer.Deserialize<List<T>>(inputByteArray); | ||
if(deserializedList == null) | ||
{ | ||
throw new Exception(); | ||
} | ||
return deserializedList; | ||
} | ||
|
||
public static byte[] ObjectListToByteArray(List<T> inputList) | ||
{ | ||
var bytes = JsonSerializer.SerializeToUtf8Bytes(inputList); | ||
|
||
return bytes; | ||
} | ||
|
||
public static T ByteArrayToObject(byte[] inputByteArray) | ||
{ | ||
var deserializedList = JsonSerializer.Deserialize<T>(inputByteArray); | ||
if (deserializedList == null) | ||
{ | ||
throw new Exception(); | ||
} | ||
return deserializedList; | ||
} | ||
|
||
public static byte[] ObjectToByteArray(T input) | ||
{ | ||
var bytes = JsonSerializer.SerializeToUtf8Bytes(input); | ||
|
||
return bytes; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0"> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" /> | ||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="7.0.5" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.AzureAppServices" Version="7.0.5" /> | ||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.6" /> | ||
</ItemGroup> | ||
|
||
</Project> |
11 changes: 6 additions & 5 deletions
11
.../20221219160330_InitialCreate.Designer.cs → .../20230509140701_InitialCreate.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.