update to rc2
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
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
|
||||
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
|
||||
global.json = global.json
|
||||
NuGet.Config = NuGet.Config
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
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
|
||||
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
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@@ -21,20 +21,20 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4220710A-3EC2-4449-BC86-B75F0A58D003}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D2C11E75-BAC6-4619-930E-CCA94474365E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1976F662-ED03-4321-B4B3-E48BF750E144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1976F662-ED03-4321-B4B3-E48BF750E144}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1976F662-ED03-4321-B4B3-E48BF750E144}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1976F662-ED03-4321-B4B3-E48BF750E144}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E1B14BDB-46C5-4792-A95E-41D9461298E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{4220710A-3EC2-4449-BC86-B75F0A58D003} = {C054D790-3899-4B62-97FA-0053C7437FA5}
|
||||
{D2C11E75-BAC6-4619-930E-CCA94474365E} = {C054D790-3899-4B62-97FA-0053C7437FA5}
|
||||
{1976F662-ED03-4321-B4B3-E48BF750E144} = {265BAFB4-AB2C-452A-93BD-8015490E421E}
|
||||
{E1B14BDB-46C5-4792-A95E-41D9461298E2} = {265BAFB4-AB2C-452A-93BD-8015490E421E}
|
||||
EndGlobalSection
|
||||
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
|
||||
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" ],
|
||||
"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>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>4220710a-3ec2-4449-bc86-b75f0a58d003</ProjectGuid>
|
||||
<ProjectGuid>1976f662-ed03-4321-b4b3-e48bf750e144</ProjectGuid>
|
||||
<RootNamespace>AzureTableStorageCache</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</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.Linq;
|
||||
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
|
||||
{
|
||||
@@ -20,20 +20,16 @@ namespace Microsoft.AspNet.Builder
|
||||
/// <returns></returns>
|
||||
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");
|
||||
}
|
||||
if(services == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add azure table storage cache as an IDistributedCache to the service container
|
||||
/// </summary>
|
||||
@@ -45,36 +41,31 @@ namespace Microsoft.AspNet.Builder
|
||||
/// <returns></returns>
|
||||
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");
|
||||
}
|
||||
if(string.IsNullOrWhiteSpace(accountKey))
|
||||
if (string.IsNullOrWhiteSpace(accountKey))
|
||||
{
|
||||
throw new ArgumentNullException("accountKey must not be null");
|
||||
}
|
||||
if(services == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(services));
|
||||
}
|
||||
|
||||
//services.AddSingleton<Azure>
|
||||
services.Add(ServiceDescriptor.Singleton<IDistributedCache, AzureTableStorageCacheHandler>(a =>
|
||||
new AzureTableStorageCacheHandler(accountName, accountKey, tableName, partitionKey)));
|
||||
return services;
|
||||
}
|
||||
|
||||
private static void checkTableData(string tableName, string partitionkey)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(tableName))
|
||||
if (string.IsNullOrWhiteSpace(tableName))
|
||||
{
|
||||
throw new ArgumentNullException("tableName must not be null");
|
||||
}
|
||||
if(string.IsNullOrWhiteSpace(partitionkey))
|
||||
if (string.IsNullOrWhiteSpace(partitionkey))
|
||||
{
|
||||
throw new ArgumentNullException("partitionkey must not be null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using AzureTableStorageCache.Model;
|
||||
using Microsoft.Framework.Caching.Distributed;
|
||||
using Microsoft.Framework.Internal;
|
||||
using AzureTableStorageCache.Model;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Internal;
|
||||
using Microsoft.WindowsAzure.Storage;
|
||||
using Microsoft.WindowsAzure.Storage.Auth;
|
||||
using Microsoft.WindowsAzure.Storage.Table;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AzureTableStorageCache
|
||||
{
|
||||
@@ -21,13 +21,14 @@ namespace AzureTableStorageCache
|
||||
private readonly string connectionString;
|
||||
private CloudTableClient client;
|
||||
private CloudTable azuretable;
|
||||
|
||||
private AzureTableStorageCacheHandler(string tableName, string partitionKey)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(tableName))
|
||||
if (string.IsNullOrWhiteSpace(tableName))
|
||||
{
|
||||
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");
|
||||
}
|
||||
@@ -35,29 +36,29 @@ namespace AzureTableStorageCache
|
||||
this.partitionKey = partitionKey;
|
||||
Connect();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
if(string.IsNullOrWhiteSpace(accountKey))
|
||||
if (string.IsNullOrWhiteSpace(accountKey))
|
||||
{
|
||||
throw new ArgumentNullException("accountKey cannot be null or empty");
|
||||
}
|
||||
|
||||
|
||||
this.accountName = accountName;
|
||||
this.accountKey = accountKey;
|
||||
|
||||
}
|
||||
|
||||
private readonly string tableName;
|
||||
|
||||
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");
|
||||
}
|
||||
@@ -72,9 +73,9 @@ namespace AzureTableStorageCache
|
||||
|
||||
public async Task ConnectAsync()
|
||||
{
|
||||
if(client == null)
|
||||
if (client == null)
|
||||
{
|
||||
if(string.IsNullOrWhiteSpace(connectionString))
|
||||
if (string.IsNullOrWhiteSpace(connectionString))
|
||||
{
|
||||
var creds = new StorageCredentials(accountKey, accountKey);
|
||||
client = new CloudStorageAccount(creds, true).CreateCloudTableClient();
|
||||
@@ -84,7 +85,7 @@ namespace AzureTableStorageCache
|
||||
client = CloudStorageAccount.Parse(connectionString).CreateCloudTableClient();
|
||||
}
|
||||
}
|
||||
if(azuretable == null)
|
||||
if (azuretable == null)
|
||||
{
|
||||
this.azuretable = client.GetTableReference(this.tableName);
|
||||
await this.azuretable.CreateIfNotExistsAsync();
|
||||
@@ -113,24 +114,24 @@ namespace AzureTableStorageCache
|
||||
var op = TableOperation.Retrieve(partitionKey, key);
|
||||
var result = await azuretable.ExecuteAsync(op);
|
||||
var data = result?.Result as CachedItem;
|
||||
if(data != null)
|
||||
if (data != null)
|
||||
{
|
||||
if(ShouldDelete(data))
|
||||
if (ShouldDelete(data))
|
||||
{
|
||||
await RemoveAsync(key);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShouldDelete(CachedItem data)
|
||||
{
|
||||
var currentTime = DateTimeOffset.UtcNow;
|
||||
if(data.AbsolutExperiation != null && data.AbsolutExperiation.Value <= currentTime)
|
||||
if (data.AbsolutExperiation != null && data.AbsolutExperiation.Value <= currentTime)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -158,13 +159,13 @@ namespace AzureTableStorageCache
|
||||
{
|
||||
DateTimeOffset? absoluteExpiration = null;
|
||||
var currentTime = DateTimeOffset.UtcNow;
|
||||
if(options.AbsoluteExpirationRelativeToNow.HasValue)
|
||||
if (options.AbsoluteExpirationRelativeToNow.HasValue)
|
||||
{
|
||||
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(
|
||||
nameof(options.AbsoluteExpiration),
|
||||
@@ -172,9 +173,8 @@ namespace AzureTableStorageCache
|
||||
"The absolute expiration value must be in the future.");
|
||||
}
|
||||
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);
|
||||
return this.azuretable.ExecuteAsync(op);
|
||||
}
|
||||
|
||||
@@ -5,14 +5,10 @@ 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("AzureTableStorageCache")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("AzureTableStorageCache")]
|
||||
[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
|
||||
@@ -20,4 +16,4 @@ using System.Runtime.InteropServices;
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 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-*",
|
||||
"description": "AzureTableStorageCache Class Library",
|
||||
"authors": [ "parne" ],
|
||||
"tags": [ "" ],
|
||||
"projectUrl": "",
|
||||
"licenseUrl": "",
|
||||
|
||||
"dependencies": {
|
||||
"WindowsAzure.Storage": "6.1.1-preview",
|
||||
"Microsoft.Framework.Caching.Abstractions": "1.0.0-beta8",
|
||||
"Microsoft.Framework.DependencyInjection": "1.0.0-beta8"
|
||||
"NETStandard.Library": "1.5.0-rc2-24027",
|
||||
"Microsoft.Extensions.Caching.Abstractions": "1.0.0-rc2-final",
|
||||
"Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final",
|
||||
"WindowsAzure.Storage": "7.0.0"
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
"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"
|
||||
}
|
||||
"net452": {
|
||||
"imports": "dnxcore50"
|
||||
}
|
||||
},
|
||||
"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>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>d2c11e75-bac6-4619-930e-cca94474365e</ProjectGuid>
|
||||
<ProjectGuid>e1b14bdb-46c5-4792-a95e-41d9461298e2</ProjectGuid>
|
||||
<RootNamespace>AzureTableStorageCacheSample</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>50593</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
<ItemGroup>
|
||||
<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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.Framework.Caching.Distributed;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AzureTableStorageCache.Sample.Controllers
|
||||
namespace AzureTableStorageCacheSample.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private readonly IDistributedCache cacheMechanism;
|
||||
|
||||
public HomeController(IDistributedCache cacheMechanism)
|
||||
public IActionResult Index()
|
||||
{
|
||||
this.cacheMechanism = cacheMechanism;
|
||||
}
|
||||
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);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public async Task<IActionResult> AddCache()
|
||||
public IActionResult About()
|
||||
{
|
||||
cacheMechanism.SetAsync("awesomeRecord", Encoding.UTF32.GetBytes("Im Awesome"));
|
||||
ViewData["Message"] = "Your application description page.";
|
||||
|
||||
return RedirectToAction("Index");
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult Contact()
|
||||
@@ -45,7 +29,7 @@ namespace AzureTableStorageCache.Sample.Controllers
|
||||
|
||||
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.Linq;
|
||||
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
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||
public Startup(IHostingEnvironment env)
|
||||
{
|
||||
// Setup configuration sources.
|
||||
var builder = new ConfigurationBuilder()
|
||||
.SetBasePath(appEnv.ApplicationBasePath)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.SetBasePath(env.ContentRootPath)
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
|
||||
.AddEnvironmentVariables();
|
||||
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)
|
||||
{
|
||||
services.AddAzureTableStorageCache("!!!CONNECTIONSTRINGHERE!!!", "awesomeTable", "cachedDataKey");
|
||||
// Add MVC services to the services container.
|
||||
services.AddAzureTableStorageCache("!!!CONNECTIONSTRINGHERE!!!", "tablename", "partitionKey");
|
||||
// Add framework services.
|
||||
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)
|
||||
{
|
||||
loggerFactory.MinimumLevel = LogLevel.Information;
|
||||
loggerFactory.AddConsole();
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
loggerFactory.AddDebug();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
// Add the following to the request pipeline only in development environment.
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseBrowserLink();
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseBrowserLink();
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
// Add the platform handler to the request pipeline.
|
||||
app.UseIISPlatformHandler();
|
||||
|
||||
// Add static files to the request pipeline.
|
||||
app.UseStaticFiles();
|
||||
|
||||
// Add MVC to the request pipeline.
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
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";
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
@if(string.IsNullOrWhiteSpace(Model))
|
||||
{
|
||||
<span>No data found</span>
|
||||
<a asp-action="AddCache" class="btn btn-primary">Add Item To Cache</a>
|
||||
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
|
||||
<li data-target="#myCarousel" data-slide-to="1"></li>
|
||||
<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>
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>Cached Data: @Model</span>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<h2>Application uses</h2>
|
||||
<ul>
|
||||
<li>Sample pages using ASP.NET Core MVC</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 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>
|
||||
<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>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - AzureTableStorageCacheSample</title>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - AzureTableStorageCacheSample</title>
|
||||
|
||||
<environment names="Development">
|
||||
<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" />
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<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-test-class="hidden" asp-fallback-test-property="visibility" asp-fallback-test-value="hidden" />
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/css/bootstrap-touch-carousel.css"
|
||||
asp-fallback-href="~/lib/bootstrap-touch-carousel/css/bootstrap-touch-carousel.css"
|
||||
asp-fallback-test-class="carousel-caption" asp-fallback-test-property="display" asp-fallback-test-value="none" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
</environment>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-controller="Home" asp-action="Index" class="navbar-brand">AzureTableStorageCacheSample</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<environment names="Development">
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/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" />
|
||||
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
|
||||
</environment>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a asp-controller="Home" asp-action="Index" class="navbar-brand">AzureTableStorageCacheSample</a>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
|
||||
<li><a asp-controller="Home" asp-action="About">About</a></li>
|
||||
<li><a asp-controller="Home" asp-action="Contact">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2015 - AzureTableStorageCacheSample</p>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<footer>
|
||||
<p>© 2016 - AzureTableStorageCacheSample</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/lib/hammer.js/hammer.js"></script>
|
||||
<script src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||
</script>
|
||||
<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>
|
||||
<environment names="Development">
|
||||
<script src="~/lib/jquery/dist/jquery.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
<environment names="Staging,Production">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js"
|
||||
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
|
||||
</script>
|
||||
<script src="~/js/site.min.js" asp-append-version="true"></script>
|
||||
</environment>
|
||||
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
@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,
|
||||
"dependencies": {
|
||||
"bootstrap": "3.0.0",
|
||||
"bootstrap-touch-carousel": "0.8.0",
|
||||
"hammer.js": "2.0.4",
|
||||
"jquery": "2.1.4",
|
||||
"jquery-validation": "1.11.1",
|
||||
"jquery-validation-unobtrusive": "3.2.2"
|
||||
"bootstrap": "3.3.6",
|
||||
"jquery": "2.2.0",
|
||||
"jquery-validation": "1.14.0",
|
||||
"jquery-validation-unobtrusive": "3.2.6"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
/// <binding Clean='clean' />
|
||||
"use strict";
|
||||
|
||||
var gulp = require("gulp"),
|
||||
rimraf = require("rimraf"),
|
||||
concat = require("gulp-concat"),
|
||||
cssmin = require("gulp-cssmin"),
|
||||
uglify = require("gulp-uglify"),
|
||||
project = require("./project.json");
|
||||
uglify = require("gulp-uglify");
|
||||
|
||||
var webroot = "./wwwroot/";
|
||||
|
||||
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) {
|
||||
rimraf(paths.concatJsDest, cb);
|
||||
});
|
||||
@@ -29,14 +29,14 @@ gulp.task("clean:css", function (cb) {
|
||||
gulp.task("clean", ["clean:js", "clean:css"]);
|
||||
|
||||
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(uglify())
|
||||
.pipe(gulp.dest("."));
|
||||
});
|
||||
|
||||
gulp.task("min:css", function () {
|
||||
gulp.src([paths.css, "!" + paths.minCss])
|
||||
return gulp.src([paths.css, "!" + paths.minCss])
|
||||
.pipe(concat(paths.concatCssDest))
|
||||
.pipe(cssmin())
|
||||
.pipe(gulp.dest("."));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "ASP.NET",
|
||||
"name": "asp.net",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"gulp": "3.8.11",
|
||||
"gulp-concat": "2.5.2",
|
||||
|
||||
@@ -1,41 +1,54 @@
|
||||
{
|
||||
"webroot": "wwwroot",
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Diagnostics": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
|
||||
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta8",
|
||||
"Microsoft.AspNet.Server.Kestrel": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.StaticFiles": "1.0.0-beta8",
|
||||
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Configuration.Json": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Logging": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Logging.Console": "1.0.0-beta8",
|
||||
"Microsoft.Framework.Logging.Debug": "1.0.0-beta8",
|
||||
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta8",
|
||||
"AzureTableStorageCache": ""
|
||||
"AzureTableStorageCache": "1.0.0-*",
|
||||
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
|
||||
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
|
||||
"Microsoft.AspNetCore.Razor.Tools": {
|
||||
"version": "1.0.0-preview1-final",
|
||||
"type": "build"
|
||||
},
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
|
||||
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
|
||||
"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": {
|
||||
"web": "Microsoft.AspNet.Server.Kestrel"
|
||||
"tools": {
|
||||
"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": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
"net452": { }
|
||||
},
|
||||
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true,
|
||||
"preserveCompilationContext": true
|
||||
},
|
||||
|
||||
"publishOptions": {
|
||||
"include": [
|
||||
"wwwroot",
|
||||
"Views",
|
||||
"appsettings.json",
|
||||
"web.config"
|
||||
]
|
||||
},
|
||||
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules"
|
||||
],
|
||||
"publishExclude": [
|
||||
"**.user",
|
||||
"**.vspscc"
|
||||
],
|
||||
"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