update to rc2
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.23107.0
|
VisualStudioVersion = 14.0.25123.0
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C054D790-3899-4B62-97FA-0053C7437FA5}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{265BAFB4-AB2C-452A-93BD-8015490E421E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A424946D-7019-4CA7-A1F0-05B616CD3A49}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FBBE899D-D31C-4DAB-BE1D-2F9DD5B20AB2}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
global.json = global.json
|
global.json = global.json
|
||||||
NuGet.Config = NuGet.Config
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AzureTableStorageCache", "src\AzureTableStorageCache\AzureTableStorageCache.xproj", "{4220710A-3EC2-4449-BC86-B75F0A58D003}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AzureTableStorageCache", "src\AzureTableStorageCache\AzureTableStorageCache.xproj", "{1976F662-ED03-4321-B4B3-E48BF750E144}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AzureTableStorageCacheSample", "src\AzureTableStorageCacheSample\AzureTableStorageCacheSample.xproj", "{D2C11E75-BAC6-4619-930E-CCA94474365E}"
|
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "AzureTableStorageCacheSample", "src\AzureTableStorageCacheSample\AzureTableStorageCacheSample.xproj", "{E1B14BDB-46C5-4792-A95E-41D9461298E2}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -21,20 +21,20 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{1976F662-ED03-4321-B4B3-E48BF750E144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1976F662-ED03-4321-B4B3-E48BF750E144}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1976F662-ED03-4321-B4B3-E48BF750E144}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1976F662-ED03-4321-B4B3-E48BF750E144}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{4220710A-3EC2-4449-BC86-B75F0A58D003} = {C054D790-3899-4B62-97FA-0053C7437FA5}
|
{1976F662-ED03-4321-B4B3-E48BF750E144} = {265BAFB4-AB2C-452A-93BD-8015490E421E}
|
||||||
{D2C11E75-BAC6-4619-930E-CCA94474365E} = {C054D790-3899-4B62-97FA-0053C7437FA5}
|
{E1B14BDB-46C5-4792-A95E-41D9461298E2} = {265BAFB4-AB2C-452A-93BD-8015490E421E}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<configuration>
|
|
||||||
<packageSources>
|
|
||||||
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
|
|
||||||
<clear />
|
|
||||||
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
|
|
||||||
</packageSources>
|
|
||||||
</configuration>
|
|
||||||
19
README.md
19
README.md
@@ -1,4 +1,19 @@
|
|||||||
# AspNetCache-AzureTableStorage
|
# AspNetCache-AzureTableStorage
|
||||||
Use azure table storage for AspNet 5 Distributed Cache.
|
Use azure table storage for AspNet core 1.0 Distributed Cache.
|
||||||
|
|
||||||
Azure Table Storage is a very cheap, super fast key value store, and its much cheaper than the redis cluster in azure. This is not a true replacement for redis, and redis should be used if people have money, but this is designed to get people a very cheap cache in azure.
|
Azure Table Storage is a very cheap, super fast key value store, and its much cheaper than the redis cluster in azure. This is not a true replacement for redis, and redis should be used if people have money, but this is designed to get people a very cheap cache in azure.
|
||||||
|
|
||||||
|
|
||||||
|
## How to use
|
||||||
|
|
||||||
|
install-package `AzureTableStorageCache`
|
||||||
|
|
||||||
|
In your startup.cs
|
||||||
|
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
|
||||||
|
services.AddAzureTableStorageCache("!!!CONNECTIONSTRINGHERE!!!", "tablename", "cachedDataKey");
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"projects": [ "src", "test" ],
|
"projects": [ "src", "test" ],
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"version": "1.0.0-beta8"
|
"version": "1.0.0-preview1-002702"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,17 @@
|
|||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>4220710a-3ec2-4449-bc86-b75f0a58d003</ProjectGuid>
|
<ProjectGuid>1976f662-ed03-4321-b4b3-e48bf750e144</ProjectGuid>
|
||||||
<RootNamespace>AzureTableStorageCache</RootNamespace>
|
<RootNamespace>AzureTableStorageCache</RootNamespace>
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using AzureTableStorageCache;
|
||||||
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Framework.Caching.Distributed;
|
|
||||||
using Microsoft.Framework.DependencyInjection;
|
|
||||||
using AzureTableStorageCache;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Builder
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
{
|
{
|
||||||
public static class AzureTableStorageCacheExtensions
|
public static class AzureTableStorageCacheExtensions
|
||||||
{
|
{
|
||||||
@@ -20,20 +20,16 @@ namespace Microsoft.AspNet.Builder
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IServiceCollection AddAzureTableStorageCache(this IServiceCollection services, string connectionString, string tableName, string partitionKey)
|
public static IServiceCollection AddAzureTableStorageCache(this IServiceCollection services, string connectionString, string tableName, string partitionKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(connectionString))
|
if (string.IsNullOrWhiteSpace(connectionString))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("connectionString must not be null");
|
throw new ArgumentNullException("connectionString must not be null");
|
||||||
}
|
}
|
||||||
if(services == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(services));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//services.AddSingleton<Azure>
|
//services.AddSingleton<Azure>
|
||||||
services.Add(ServiceDescriptor.Singleton<IDistributedCache, AzureTableStorageCacheHandler>(a=> new AzureTableStorageCacheHandler(connectionString, tableName, partitionKey)));
|
services.Add(ServiceDescriptor.Singleton<IDistributedCache, AzureTableStorageCacheHandler>(a => new AzureTableStorageCacheHandler(connectionString, tableName, partitionKey)));
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add azure table storage cache as an IDistributedCache to the service container
|
/// Add azure table storage cache as an IDistributedCache to the service container
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -45,36 +41,31 @@ namespace Microsoft.AspNet.Builder
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IServiceCollection AddAzureTableStorageCache(this IServiceCollection services, string accountName, string accountKey, string tableName, string partitionKey)
|
public static IServiceCollection AddAzureTableStorageCache(this IServiceCollection services, string accountName, string accountKey, string tableName, string partitionKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(accountName))
|
if (string.IsNullOrWhiteSpace(accountName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("accountName must not be null");
|
throw new ArgumentNullException("accountName must not be null");
|
||||||
}
|
}
|
||||||
if(string.IsNullOrWhiteSpace(accountKey))
|
if (string.IsNullOrWhiteSpace(accountKey))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("accountKey must not be null");
|
throw new ArgumentNullException("accountKey must not be null");
|
||||||
}
|
}
|
||||||
if(services == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(services));
|
|
||||||
}
|
|
||||||
|
|
||||||
//services.AddSingleton<Azure>
|
//services.AddSingleton<Azure>
|
||||||
services.Add(ServiceDescriptor.Singleton<IDistributedCache, AzureTableStorageCacheHandler>(a =>
|
services.Add(ServiceDescriptor.Singleton<IDistributedCache, AzureTableStorageCacheHandler>(a =>
|
||||||
new AzureTableStorageCacheHandler(accountName, accountKey, tableName, partitionKey)));
|
new AzureTableStorageCacheHandler(accountName, accountKey, tableName, partitionKey)));
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkTableData(string tableName, string partitionkey)
|
private static void checkTableData(string tableName, string partitionkey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(tableName))
|
if (string.IsNullOrWhiteSpace(tableName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("tableName must not be null");
|
throw new ArgumentNullException("tableName must not be null");
|
||||||
}
|
}
|
||||||
if(string.IsNullOrWhiteSpace(partitionkey))
|
if (string.IsNullOrWhiteSpace(partitionkey))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("partitionkey must not be null");
|
throw new ArgumentNullException("partitionkey must not be null");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
using System;
|
using AzureTableStorageCache.Model;
|
||||||
using System.Collections.Generic;
|
using Microsoft.Extensions.Caching.Distributed;
|
||||||
using System.Linq;
|
using Microsoft.Extensions.Internal;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using AzureTableStorageCache.Model;
|
|
||||||
using Microsoft.Framework.Caching.Distributed;
|
|
||||||
using Microsoft.Framework.Internal;
|
|
||||||
using Microsoft.WindowsAzure.Storage;
|
using Microsoft.WindowsAzure.Storage;
|
||||||
using Microsoft.WindowsAzure.Storage.Auth;
|
using Microsoft.WindowsAzure.Storage.Auth;
|
||||||
using Microsoft.WindowsAzure.Storage.Table;
|
using Microsoft.WindowsAzure.Storage.Table;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace AzureTableStorageCache
|
namespace AzureTableStorageCache
|
||||||
{
|
{
|
||||||
@@ -21,13 +21,14 @@ namespace AzureTableStorageCache
|
|||||||
private readonly string connectionString;
|
private readonly string connectionString;
|
||||||
private CloudTableClient client;
|
private CloudTableClient client;
|
||||||
private CloudTable azuretable;
|
private CloudTable azuretable;
|
||||||
|
|
||||||
private AzureTableStorageCacheHandler(string tableName, string partitionKey)
|
private AzureTableStorageCacheHandler(string tableName, string partitionKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(tableName))
|
if (string.IsNullOrWhiteSpace(tableName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("tableName cannot be null or empty");
|
throw new ArgumentNullException("tableName cannot be null or empty");
|
||||||
}
|
}
|
||||||
if(string.IsNullOrWhiteSpace(partitionKey))
|
if (string.IsNullOrWhiteSpace(partitionKey))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("partitionKey cannot be null or empty");
|
throw new ArgumentNullException("partitionKey cannot be null or empty");
|
||||||
}
|
}
|
||||||
@@ -35,29 +36,29 @@ namespace AzureTableStorageCache
|
|||||||
this.partitionKey = partitionKey;
|
this.partitionKey = partitionKey;
|
||||||
Connect();
|
Connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AzureTableStorageCacheHandler(string accountName, string accountKey, string tableName, string partitionKey)
|
public AzureTableStorageCacheHandler(string accountName, string accountKey, string tableName, string partitionKey)
|
||||||
:this(tableName, partitionKey)
|
: this(tableName, partitionKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(accountName))
|
if (string.IsNullOrWhiteSpace(accountName))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("accountName cannot be null or empty");
|
throw new ArgumentNullException("accountName cannot be null or empty");
|
||||||
}
|
}
|
||||||
if(string.IsNullOrWhiteSpace(accountKey))
|
if (string.IsNullOrWhiteSpace(accountKey))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("accountKey cannot be null or empty");
|
throw new ArgumentNullException("accountKey cannot be null or empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.accountName = accountName;
|
this.accountName = accountName;
|
||||||
this.accountKey = accountKey;
|
this.accountKey = accountKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly string tableName;
|
private readonly string tableName;
|
||||||
|
|
||||||
public AzureTableStorageCacheHandler(string connectionString, string tableName, string partitionKey)
|
public AzureTableStorageCacheHandler(string connectionString, string tableName, string partitionKey)
|
||||||
:this(tableName, partitionKey)
|
: this(tableName, partitionKey)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(connectionString))
|
if (string.IsNullOrWhiteSpace(connectionString))
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Connection string cannot be null or empty");
|
throw new ArgumentNullException("Connection string cannot be null or empty");
|
||||||
}
|
}
|
||||||
@@ -72,9 +73,9 @@ namespace AzureTableStorageCache
|
|||||||
|
|
||||||
public async Task ConnectAsync()
|
public async Task ConnectAsync()
|
||||||
{
|
{
|
||||||
if(client == null)
|
if (client == null)
|
||||||
{
|
{
|
||||||
if(string.IsNullOrWhiteSpace(connectionString))
|
if (string.IsNullOrWhiteSpace(connectionString))
|
||||||
{
|
{
|
||||||
var creds = new StorageCredentials(accountKey, accountKey);
|
var creds = new StorageCredentials(accountKey, accountKey);
|
||||||
client = new CloudStorageAccount(creds, true).CreateCloudTableClient();
|
client = new CloudStorageAccount(creds, true).CreateCloudTableClient();
|
||||||
@@ -84,7 +85,7 @@ namespace AzureTableStorageCache
|
|||||||
client = CloudStorageAccount.Parse(connectionString).CreateCloudTableClient();
|
client = CloudStorageAccount.Parse(connectionString).CreateCloudTableClient();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(azuretable == null)
|
if (azuretable == null)
|
||||||
{
|
{
|
||||||
this.azuretable = client.GetTableReference(this.tableName);
|
this.azuretable = client.GetTableReference(this.tableName);
|
||||||
await this.azuretable.CreateIfNotExistsAsync();
|
await this.azuretable.CreateIfNotExistsAsync();
|
||||||
@@ -113,24 +114,24 @@ namespace AzureTableStorageCache
|
|||||||
var op = TableOperation.Retrieve(partitionKey, key);
|
var op = TableOperation.Retrieve(partitionKey, key);
|
||||||
var result = await azuretable.ExecuteAsync(op);
|
var result = await azuretable.ExecuteAsync(op);
|
||||||
var data = result?.Result as CachedItem;
|
var data = result?.Result as CachedItem;
|
||||||
if(data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
if(ShouldDelete(data))
|
if (ShouldDelete(data))
|
||||||
{
|
{
|
||||||
await RemoveAsync(key);
|
await RemoveAsync(key);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ShouldDelete(CachedItem data)
|
private bool ShouldDelete(CachedItem data)
|
||||||
{
|
{
|
||||||
var currentTime = DateTimeOffset.UtcNow;
|
var currentTime = DateTimeOffset.UtcNow;
|
||||||
if(data.AbsolutExperiation != null && data.AbsolutExperiation.Value <= currentTime)
|
if (data.AbsolutExperiation != null && data.AbsolutExperiation.Value <= currentTime)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(data.SlidingExperiation.HasValue && data.LastAccessTime.HasValue && data.LastAccessTime <= currentTime.Add(data.SlidingExperiation.Value))
|
if (data.SlidingExperiation.HasValue && data.LastAccessTime.HasValue && data.LastAccessTime <= currentTime.Add(data.SlidingExperiation.Value))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -158,13 +159,13 @@ namespace AzureTableStorageCache
|
|||||||
{
|
{
|
||||||
DateTimeOffset? absoluteExpiration = null;
|
DateTimeOffset? absoluteExpiration = null;
|
||||||
var currentTime = DateTimeOffset.UtcNow;
|
var currentTime = DateTimeOffset.UtcNow;
|
||||||
if(options.AbsoluteExpirationRelativeToNow.HasValue)
|
if (options.AbsoluteExpirationRelativeToNow.HasValue)
|
||||||
{
|
{
|
||||||
absoluteExpiration = currentTime.Add(options.AbsoluteExpirationRelativeToNow.Value);
|
absoluteExpiration = currentTime.Add(options.AbsoluteExpirationRelativeToNow.Value);
|
||||||
}
|
}
|
||||||
else if(options.AbsoluteExpiration.HasValue)
|
else if (options.AbsoluteExpiration.HasValue)
|
||||||
{
|
{
|
||||||
if(options.AbsoluteExpiration.Value <= currentTime)
|
if (options.AbsoluteExpiration.Value <= currentTime)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(
|
throw new ArgumentOutOfRangeException(
|
||||||
nameof(options.AbsoluteExpiration),
|
nameof(options.AbsoluteExpiration),
|
||||||
@@ -172,9 +173,8 @@ namespace AzureTableStorageCache
|
|||||||
"The absolute expiration value must be in the future.");
|
"The absolute expiration value must be in the future.");
|
||||||
}
|
}
|
||||||
absoluteExpiration = options.AbsoluteExpiration;
|
absoluteExpiration = options.AbsoluteExpiration;
|
||||||
|
|
||||||
}
|
}
|
||||||
var item = new CachedItem(partitionKey, key, value) { LastAccessTime = currentTime };
|
var item = new CachedItem(partitionKey, key, value) { LastAccessTime = currentTime };
|
||||||
var op = TableOperation.InsertOrReplace(item);
|
var op = TableOperation.InsertOrReplace(item);
|
||||||
return this.azuretable.ExecuteAsync(op);
|
return this.azuretable.ExecuteAsync(op);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,10 @@ using System.Runtime.InteropServices;
|
|||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
[assembly: AssemblyTitle("AzureTableStorageCache")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("AzureTableStorageCache")]
|
[assembly: AssemblyProduct("AzureTableStorageCache")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
@@ -20,4 +16,4 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
[assembly: Guid("4220710a-3ec2-4449-bc86-b75f0a58d003")]
|
[assembly: Guid("1976f662-ed03-4321-b4b3-e48bf750e144")]
|
||||||
@@ -1,25 +1,25 @@
|
|||||||
{
|
{
|
||||||
"version": "1.0.0-*",
|
"version": "1.0.0-*",
|
||||||
"description": "AzureTableStorageCache Class Library",
|
|
||||||
"authors": [ "parne" ],
|
|
||||||
"tags": [ "" ],
|
|
||||||
"projectUrl": "",
|
|
||||||
"licenseUrl": "",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"WindowsAzure.Storage": "6.1.1-preview",
|
"NETStandard.Library": "1.5.0-rc2-24027",
|
||||||
"Microsoft.Framework.Caching.Abstractions": "1.0.0-beta8",
|
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-rc2-final",
|
||||||
"Microsoft.Framework.DependencyInjection": "1.0.0-beta8"
|
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final",
|
||||||
|
"WindowsAzure.Storage": "7.0.0"
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net45": { },
|
"net452": {
|
||||||
"dnxcore50": {
|
"imports": "dnxcore50"
|
||||||
"dependencies": {
|
|
||||||
"Microsoft.CSharp": "4.0.1-beta-23409",
|
|
||||||
"System.Collections": "4.0.11-beta-23409",
|
|
||||||
"System.Linq": "4.0.1-beta-23409",
|
|
||||||
"System.Runtime": "4.0.21-beta-23409",
|
|
||||||
"System.Threading": "4.0.11-beta-23409"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"packOptions": {
|
||||||
|
"owners": [ "Tommy Parnell" ],
|
||||||
|
"projectUrl": "https://github.com/tparnell8/AzureTableStorageCache.git",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/tparnell8/AzureTableStorageCache.git"
|
||||||
|
},
|
||||||
|
"summary": "Use azure table storage for a distributed cache in aspnet applications"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -4,16 +4,22 @@
|
|||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
<ProjectGuid>d2c11e75-bac6-4619-930e-cca94474365e</ProjectGuid>
|
<ProjectGuid>e1b14bdb-46c5-4792-a95e-41d9461298e2</ProjectGuid>
|
||||||
<RootNamespace>AzureTableStorageCacheSample</RootNamespace>
|
<RootNamespace>AzureTableStorageCacheSample</RootNamespace>
|
||||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||||
|
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
<DevelopmentServerPort>50593</DevelopmentServerPort>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
<ItemGroup>
|
||||||
</Project>
|
<DnxInvisibleContent Include="bower.json" />
|
||||||
|
<DnxInvisibleContent Include=".bowerrc" />
|
||||||
|
<DnxInvisibleContent Include="package.json" />
|
||||||
|
<DnxInvisibleContent Include=".npmrc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||||
|
</Project>
|
||||||
|
|||||||
@@ -1,39 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Framework.Caching.Distributed;
|
|
||||||
|
|
||||||
namespace AzureTableStorageCache.Sample.Controllers
|
namespace AzureTableStorageCacheSample.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly IDistributedCache cacheMechanism;
|
public IActionResult Index()
|
||||||
|
|
||||||
public HomeController(IDistributedCache cacheMechanism)
|
|
||||||
{
|
{
|
||||||
this.cacheMechanism = cacheMechanism;
|
return View();
|
||||||
}
|
|
||||||
public async Task<IActionResult> Index()
|
|
||||||
{
|
|
||||||
var data = await cacheMechanism.GetAsync("awesomeRecord");
|
|
||||||
var result = string.Empty;
|
|
||||||
if(data != null)
|
|
||||||
{
|
|
||||||
result = Encoding.UTF32.GetString(data);
|
|
||||||
}
|
|
||||||
return View(result);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IActionResult> AddCache()
|
public IActionResult About()
|
||||||
{
|
{
|
||||||
cacheMechanism.SetAsync("awesomeRecord", Encoding.UTF32.GetBytes("Im Awesome"));
|
|
||||||
ViewData["Message"] = "Your application description page.";
|
ViewData["Message"] = "Your application description page.";
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Contact()
|
public IActionResult Contact()
|
||||||
@@ -45,7 +29,7 @@ namespace AzureTableStorageCache.Sample.Controllers
|
|||||||
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View("~/Views/Shared/Error.cshtml");
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
src/AzureTableStorageCacheSample/Program.cs
Normal file
24
src/AzureTableStorageCacheSample/Program.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
||||||
|
namespace AzureTableStorageCacheSample
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder()
|
||||||
|
.UseKestrel()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseIISIntegration()
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
host.Run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>Welcome to ASP.NET 5</title>
|
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
background: #f1f1f1;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: #fff;
|
|
||||||
color: #505050;
|
|
||||||
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
|
|
||||||
margin: 1%;
|
|
||||||
min-height: 95.5%;
|
|
||||||
border: 1px solid silver;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header h1 {
|
|
||||||
font-size: 44px;
|
|
||||||
font-weight: normal;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px 30px 10px 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header span {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 30px;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header p {
|
|
||||||
font-size: 20px;
|
|
||||||
color: #fff;
|
|
||||||
background: #007acc;
|
|
||||||
padding: 0 30px;
|
|
||||||
line-height: 50px;
|
|
||||||
margin-top: 25px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#header p a {
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: underline;
|
|
||||||
font-weight: bold;
|
|
||||||
padding-right: 35px;
|
|
||||||
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
|
|
||||||
}
|
|
||||||
|
|
||||||
#main {
|
|
||||||
padding: 5px 30px;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
|
||||||
width: 21.7%;
|
|
||||||
float: left;
|
|
||||||
margin: 0 0 0 4%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section h2 {
|
|
||||||
font-size: 13px;
|
|
||||||
text-transform: uppercase;
|
|
||||||
margin: 0;
|
|
||||||
border-bottom: 1px solid silver;
|
|
||||||
padding-bottom: 12px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section.first {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section.first h2 {
|
|
||||||
font-size: 24px;
|
|
||||||
text-transform: none;
|
|
||||||
margin-bottom: 25px;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section.first li {
|
|
||||||
border-top: 1px solid silver;
|
|
||||||
padding: 8px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section.last {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style: none;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
line-height: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
padding: 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #267cb2;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#footer {
|
|
||||||
clear: both;
|
|
||||||
padding-top: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#footer p {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 10px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="header">
|
|
||||||
<h1>Welcome to ASP.NET 5 Preview</h1>
|
|
||||||
<span>
|
|
||||||
We've made some big updates in this release, so it’s <b>important</b> that you spend
|
|
||||||
a few minutes to learn what’s new.
|
|
||||||
<br /><br />
|
|
||||||
ASP.NET 5 has been rearchitected to make it <b>lean</b> and <b>composable</b>. It's fully
|
|
||||||
<b>open source</b> and available on <a href="http://go.microsoft.com/fwlink/?LinkID=517854">GitHub</a>.
|
|
||||||
<br />
|
|
||||||
Your new project automatically takes advantage of modern client-side utilities
|
|
||||||
like <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518005">npm</a>
|
|
||||||
(to add client-side libraries) and <a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> (for client-side build and automation tasks).
|
|
||||||
|
|
||||||
<br /><br />
|
|
||||||
We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015.
|
|
||||||
<br />
|
|
||||||
The ASP.NET Team
|
|
||||||
</span>
|
|
||||||
<p>You've created a new ASP.NET 5 project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="main">
|
|
||||||
<div class="section first">
|
|
||||||
<h2>This application consists of:</h2>
|
|
||||||
<ul>
|
|
||||||
<li>Sample pages using ASP.NET MVC 6</li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side resources</li>
|
|
||||||
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
|
||||||
<h2>New concepts</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">The 'wwwroot' explained</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518012">Configuration in ASP.NET 5</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518013">Dependency Injection</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518014">Razor TagHelpers</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517849">Manage client tasks using Gulp</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517850">Develop on different platforms</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
|
||||||
<h2>Customize app</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add Controllers and Views</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398602">Add Data using EntityFramework</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398603">Add Authentication using Identity</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398606">Add real time support using SignalR</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398604">Add Class library</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518009">Add Web APIs with MVC 6</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517848">Add client packages using Bower</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section last">
|
|
||||||
<h2>Deploy</h2>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app locally</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on ASP.NET Core 5</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Sites</a></li>
|
|
||||||
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518019">Publish to the file system</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="footer">
|
|
||||||
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
|
||||||
// set of attributes. Change these attribute values to modify the information
|
|
||||||
// associated with an assembly.
|
|
||||||
[assembly: AssemblyTitle("AzureTableStorageCacheSample")]
|
|
||||||
[assembly: AssemblyDescription("")]
|
|
||||||
[assembly: AssemblyConfiguration("")]
|
|
||||||
[assembly: AssemblyCompany("")]
|
|
||||||
[assembly: AssemblyProduct("AzureTableStorageCacheSample")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
|
||||||
[assembly: AssemblyTrademark("")]
|
|
||||||
[assembly: AssemblyCulture("")]
|
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
|
||||||
// to COM components. If you need to access a type in this assembly from
|
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
|
||||||
[assembly: ComVisible(false)]
|
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
|
||||||
[assembly: Guid("d2c11e75-bac6-4619-930e-cca94474365e")]
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"windowsAuthentication": false,
|
||||||
|
"anonymousAuthentication": true,
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:53721/",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"AzureTableStorageCacheSample": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"launchUrl": "http://localhost:5000",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,80 +1,63 @@
|
|||||||
using System;
|
using AzureTableStorageCache;
|
||||||
|
using AzureTableStorageCacheSample;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
|
||||||
using Microsoft.AspNet.Hosting;
|
|
||||||
using Microsoft.Dnx.Runtime;
|
|
||||||
using Microsoft.Framework.Configuration;
|
|
||||||
using Microsoft.Framework.DependencyInjection;
|
|
||||||
using Microsoft.Framework.Logging;
|
|
||||||
|
|
||||||
namespace AzureTableStorageCacheSample
|
namespace AzureTableStorageCacheSample
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
public Startup(IHostingEnvironment env)
|
||||||
{
|
{
|
||||||
// Setup configuration sources.
|
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(appEnv.ApplicationBasePath)
|
.SetBasePath(env.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; set; }
|
public IConfigurationRoot Configuration { get; }
|
||||||
|
|
||||||
// This method gets called by the runtime.
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddAzureTableStorageCache("!!!CONNECTIONSTRINGHERE!!!", "awesomeTable", "cachedDataKey");
|
services.AddAzureTableStorageCache("!!!CONNECTIONSTRINGHERE!!!", "tablename", "partitionKey");
|
||||||
// Add MVC services to the services container.
|
// Add framework services.
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
|
|
||||||
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
|
|
||||||
// services.AddWebApiConventions();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure is called after ConfigureServices is called.
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
loggerFactory.MinimumLevel = LogLevel.Information;
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
loggerFactory.AddConsole();
|
|
||||||
loggerFactory.AddDebug();
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
|
||||||
|
|
||||||
// Add the following to the request pipeline only in development environment.
|
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseBrowserLink();
|
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
|
app.UseBrowserLink();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add Error handling middleware which catches all application specific errors and
|
|
||||||
// send the request to the following path or controller action.
|
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the platform handler to the request pipeline.
|
|
||||||
app.UseIISPlatformHandler();
|
|
||||||
|
|
||||||
// Add static files to the request pipeline.
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
||||||
// Add MVC to the request pipeline.
|
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|
||||||
// Uncomment the following line to add a route for porting Web API 2 controllers.
|
|
||||||
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
7
src/AzureTableStorageCacheSample/Views/Home/About.cshtml
Normal file
7
src/AzureTableStorageCacheSample/Views/Home/About.cshtml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "About";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<p>Use this area to provide additional information.</p>
|
||||||
17
src/AzureTableStorageCacheSample/Views/Home/Contact.cshtml
Normal file
17
src/AzureTableStorageCacheSample/Views/Home/Contact.cshtml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Contact";
|
||||||
|
}
|
||||||
|
<h2>@ViewData["Title"].</h2>
|
||||||
|
<h3>@ViewData["Message"]</h3>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
One Microsoft Way<br />
|
||||||
|
Redmond, WA 98052-6399<br />
|
||||||
|
<abbr title="Phone">P:</abbr>
|
||||||
|
425.555.0100
|
||||||
|
</address>
|
||||||
|
|
||||||
|
<address>
|
||||||
|
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||||
|
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||||
|
</address>
|
||||||
@@ -1,17 +1,109 @@
|
|||||||
@model string
|
@{
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Home Page";
|
ViewData["Title"] = "Home Page";
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="jumbotron">
|
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||||
@if(string.IsNullOrWhiteSpace(Model))
|
<ol class="carousel-indicators">
|
||||||
{
|
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||||
<span>No data found</span>
|
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||||
<a asp-action="AddCache" class="btn btn-primary">Add Item To Cache</a>
|
<li data-target="#myCarousel" data-slide-to="2"></li>
|
||||||
|
<li data-target="#myCarousel" data-slide-to="3"></li>
|
||||||
|
</ol>
|
||||||
|
<div class="carousel-inner" role="listbox">
|
||||||
|
<div class="item active">
|
||||||
|
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how to build ASP.NET apps that can run anywhere.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
There are powerful new features in Visual Studio for building modern web apps.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner3.svg" alt="Package Management" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<img src="~/images/banner4.svg" alt="Microsoft Azure" class="img-responsive" />
|
||||||
|
<div class="carousel-caption" role="option">
|
||||||
|
<p>
|
||||||
|
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
|
||||||
|
<a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
|
||||||
|
Learn More
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||||
|
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span class="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
}
|
<div class="row">
|
||||||
else
|
<div class="col-md-3">
|
||||||
{
|
<h2>Application uses</h2>
|
||||||
<span>Cached Data: @Model</span>
|
<ul>
|
||||||
}
|
<li>Sample pages using ASP.NET Core MVC</li>
|
||||||
</div>
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</li>
|
||||||
|
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>How to</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699562">Add an appsetting in config and access it in app.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Overview</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<h2>Run & Deploy</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
|
||||||
|
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -4,3 +4,11 @@
|
|||||||
|
|
||||||
<h1 class="text-danger">Error.</h1>
|
<h1 class="text-danger">Error.</h1>
|
||||||
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
|
|
||||||
|
<h3>Development Mode</h3>
|
||||||
|
<p>
|
||||||
|
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
|
||||||
|
</p>
|
||||||
|
|||||||
@@ -1,78 +1,67 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>@ViewData["Title"] - AzureTableStorageCacheSample</title>
|
<title>@ViewData["Title"] - AzureTableStorageCacheSample</title>
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||||
<link rel="stylesheet" href="~/lib/bootstrap-touch-carousel/dist/css/bootstrap-touch-carousel.css" />
|
<link rel="stylesheet" href="~/css/site.css" />
|
||||||
<link rel="stylesheet" href="~/css/site.css" />
|
</environment>
|
||||||
</environment>
|
<environment names="Staging,Production">
|
||||||
<environment names="Staging,Production">
|
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/css/bootstrap.min.css"
|
||||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
|
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
||||||
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
|
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
|
||||||
asp-fallback-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
|
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/css/bootstrap-touch-carousel.css"
|
</environment>
|
||||||
asp-fallback-href="~/lib/bootstrap-touch-carousel/css/bootstrap-touch-carousel.css"
|
</head>
|
||||||
asp-fallback-test-class="carousel-caption" asp-fallback-test-property="display" asp-fallback-test-value="none" />
|
<body>
|
||||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||||
</environment>
|
<div class="container">
|
||||||
</head>
|
<div class="navbar-header">
|
||||||
<body>
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<div class="container">
|
<span class="icon-bar"></span>
|
||||||
<div class="navbar-header">
|
<span class="icon-bar"></span>
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
</button>
|
||||||
<span class="icon-bar"></span>
|
<a asp-controller="Home" asp-action="Index" class="navbar-brand">AzureTableStorageCacheSample</a>
|
||||||
<span class="icon-bar"></span>
|
</div>
|
||||||
</button>
|
<div class="navbar-collapse collapse">
|
||||||
<a asp-controller="Home" asp-action="Index" class="navbar-brand">AzureTableStorageCacheSample</a>
|
<ul class="nav navbar-nav">
|
||||||
</div>
|
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
||||||
<div class="navbar-collapse collapse">
|
<li><a asp-controller="Home" asp-action="About">About</a></li>
|
||||||
<ul class="nav navbar-nav">
|
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||||
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
</ul>
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="container body-content">
|
</div>
|
||||||
@RenderBody()
|
<div class="container body-content">
|
||||||
<hr />
|
@RenderBody()
|
||||||
<footer>
|
<hr />
|
||||||
<p>© 2015 - AzureTableStorageCacheSample</p>
|
<footer>
|
||||||
</footer>
|
<p>© 2016 - AzureTableStorageCacheSample</p>
|
||||||
</div>
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
<environment names="Development">
|
<environment names="Development">
|
||||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||||
<script src="~/lib/hammer.js/hammer.js"></script>
|
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||||
<script src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"></script>
|
</environment>
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
<environment names="Staging,Production">
|
||||||
</environment>
|
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||||
<environment names="Staging,Production">
|
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
|
asp-fallback-test="window.jQuery">
|
||||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
</script>
|
||||||
asp-fallback-test="window.jQuery">
|
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
|
||||||
</script>
|
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
|
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
</script>
|
||||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||||
</script>
|
</environment>
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/hammer.js/2.0.4/hammer.min.js"
|
|
||||||
asp-fallback-src="~/lib/hammer.js/hammer.js"
|
|
||||||
asp-fallback-test="window.Hammer">
|
|
||||||
</script>
|
|
||||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/js/bootstrap-touch-carousel.js"
|
|
||||||
asp-fallback-src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"
|
|
||||||
asp-fallback-test="window.Hammer && window.Hammer.Instance">
|
|
||||||
</script>
|
|
||||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
|
||||||
</environment>
|
|
||||||
|
|
||||||
@RenderSection("scripts", required: false)
|
@RenderSection("scripts", required: false)
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
@using AzureTableStorageCacheSample
|
@using AzureTableStorageCacheSample
|
||||||
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
|||||||
5
src/AzureTableStorageCacheSample/app.config
Normal file
5
src/AzureTableStorageCacheSample/app.config
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<configuration>
|
||||||
|
<runtime>
|
||||||
|
<gcServer enabled="true"/>
|
||||||
|
</runtime>
|
||||||
|
</configuration>
|
||||||
@@ -1 +1,10 @@
|
|||||||
{}
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Debug",
|
||||||
|
"System": "Information",
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "ASP.NET",
|
"name": "asp.net",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bootstrap": "3.0.0",
|
"bootstrap": "3.3.6",
|
||||||
"bootstrap-touch-carousel": "0.8.0",
|
"jquery": "2.2.0",
|
||||||
"hammer.js": "2.0.4",
|
"jquery-validation": "1.14.0",
|
||||||
"jquery": "2.1.4",
|
"jquery-validation-unobtrusive": "3.2.6"
|
||||||
"jquery-validation": "1.11.1",
|
|
||||||
"jquery-validation-unobtrusive": "3.2.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
/// <binding Clean='clean' />
|
/// <binding Clean='clean' />
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var gulp = require("gulp"),
|
var gulp = require("gulp"),
|
||||||
rimraf = require("rimraf"),
|
rimraf = require("rimraf"),
|
||||||
concat = require("gulp-concat"),
|
concat = require("gulp-concat"),
|
||||||
cssmin = require("gulp-cssmin"),
|
cssmin = require("gulp-cssmin"),
|
||||||
uglify = require("gulp-uglify"),
|
uglify = require("gulp-uglify");
|
||||||
project = require("./project.json");
|
|
||||||
|
var webroot = "./wwwroot/";
|
||||||
|
|
||||||
var paths = {
|
var paths = {
|
||||||
webroot: "./" + project.webroot + "/"
|
js: webroot + "js/**/*.js",
|
||||||
|
minJs: webroot + "js/**/*.min.js",
|
||||||
|
css: webroot + "css/**/*.css",
|
||||||
|
minCss: webroot + "css/**/*.min.css",
|
||||||
|
concatJsDest: webroot + "js/site.min.js",
|
||||||
|
concatCssDest: webroot + "css/site.min.css"
|
||||||
};
|
};
|
||||||
|
|
||||||
paths.js = paths.webroot + "js/**/*.js";
|
|
||||||
paths.minJs = paths.webroot + "js/**/*.min.js";
|
|
||||||
paths.css = paths.webroot + "css/**/*.css";
|
|
||||||
paths.minCss = paths.webroot + "css/**/*.min.css";
|
|
||||||
paths.concatJsDest = paths.webroot + "js/site.min.js";
|
|
||||||
paths.concatCssDest = paths.webroot + "css/site.min.css";
|
|
||||||
|
|
||||||
gulp.task("clean:js", function (cb) {
|
gulp.task("clean:js", function (cb) {
|
||||||
rimraf(paths.concatJsDest, cb);
|
rimraf(paths.concatJsDest, cb);
|
||||||
});
|
});
|
||||||
@@ -29,14 +29,14 @@ gulp.task("clean:css", function (cb) {
|
|||||||
gulp.task("clean", ["clean:js", "clean:css"]);
|
gulp.task("clean", ["clean:js", "clean:css"]);
|
||||||
|
|
||||||
gulp.task("min:js", function () {
|
gulp.task("min:js", function () {
|
||||||
gulp.src([paths.js, "!" + paths.minJs], { base: "." })
|
return gulp.src([paths.js, "!" + paths.minJs], { base: "." })
|
||||||
.pipe(concat(paths.concatJsDest))
|
.pipe(concat(paths.concatJsDest))
|
||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(gulp.dest("."));
|
.pipe(gulp.dest("."));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("min:css", function () {
|
gulp.task("min:css", function () {
|
||||||
gulp.src([paths.css, "!" + paths.minCss])
|
return gulp.src([paths.css, "!" + paths.minCss])
|
||||||
.pipe(concat(paths.concatCssDest))
|
.pipe(concat(paths.concatCssDest))
|
||||||
.pipe(cssmin())
|
.pipe(cssmin())
|
||||||
.pipe(gulp.dest("."));
|
.pipe(gulp.dest("."));
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ASP.NET",
|
"name": "asp.net",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gulp": "3.8.11",
|
"gulp": "3.8.11",
|
||||||
"gulp-concat": "2.5.2",
|
"gulp-concat": "2.5.2",
|
||||||
|
|||||||
@@ -1,41 +1,54 @@
|
|||||||
{
|
{
|
||||||
"webroot": "wwwroot",
|
|
||||||
"version": "1.0.0-*",
|
|
||||||
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
|
"AzureTableStorageCache": "1.0.0-*",
|
||||||
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
|
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
|
||||||
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
|
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
|
||||||
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
|
"Microsoft.AspNetCore.Razor.Tools": {
|
||||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
|
"version": "1.0.0-preview1-final",
|
||||||
"Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
|
"type": "build"
|
||||||
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
|
},
|
||||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
|
||||||
"Microsoft.Framework.Logging": "1.0.0-beta8",
|
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
|
||||||
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
|
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
|
||||||
"Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
|
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
|
||||||
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
|
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
|
||||||
"AzureTableStorageCache": ""
|
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
|
||||||
|
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final"
|
||||||
},
|
},
|
||||||
|
|
||||||
"commands": {
|
"tools": {
|
||||||
"web": "Microsoft.AspNet.Server.Kestrel"
|
"Microsoft.AspNetCore.Razor.Tools": {
|
||||||
|
"version": "1.0.0-preview1-final",
|
||||||
|
"imports": "portable-net45+win8+dnxcore50"
|
||||||
|
},
|
||||||
|
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
|
||||||
|
"version": "1.0.0-preview1-final",
|
||||||
|
"imports": "portable-net45+win8+dnxcore50"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": { },
|
"net452": { }
|
||||||
"dnxcore50": { }
|
},
|
||||||
|
|
||||||
|
"buildOptions": {
|
||||||
|
"emitEntryPoint": true,
|
||||||
|
"preserveCompilationContext": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"publishOptions": {
|
||||||
|
"include": [
|
||||||
|
"wwwroot",
|
||||||
|
"Views",
|
||||||
|
"appsettings.json",
|
||||||
|
"web.config"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"exclude": [
|
|
||||||
"wwwroot",
|
|
||||||
"node_modules"
|
|
||||||
],
|
|
||||||
"publishExclude": [
|
|
||||||
"**.user",
|
|
||||||
"**.vspscc"
|
|
||||||
],
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
|
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
|
||||||
|
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
14
src/AzureTableStorageCacheSample/web.config
Normal file
14
src/AzureTableStorageCacheSample/web.config
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Configure your application settings in appsettings.json. Learn more at http://go.microsoft.com/fwlink/?LinkId=786380
|
||||||
|
-->
|
||||||
|
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
|
||||||
|
</handlers>
|
||||||
|
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user