Skip to content

Commit 2e62564

Browse files
committed
.NET Core MVC sample added
- New project for IoC extension method for .NET standard DipendencyInjection. - Some cleanup on project frameword dependency
1 parent 9e8c33c commit 2e62564

96 files changed

Lines changed: 24115 additions & 127 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SharpRepository.AzureBlobRepository/SharpRepository.AzureBlobRepository.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard1.3;netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard1.3</TargetFrameworks>
44
<Product>SharpRepository for AzureBlob</Product>
55
<Authors>Ben Griswold, Jeff Treuting</Authors>
66
<Description>SharpRepository is a generic repository</Description>
77
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
88
<PackageId>SharpRepository.AzureTableRepository</PackageId>
9-
<PackageVersion>2.0.0-alpha2</PackageVersion>
10-
<PackageReleaseNotes>2.0.0-alpha2: merge all code</PackageReleaseNotes>
9+
<PackageVersion>2.0.1-alpha3</PackageVersion>
10+
<PackageReleaseNotes>2.0.1-alpha3: configurable via appsettings.json</PackageReleaseNotes>
1111
<PackageTags>SharpRepository Repository Azure Blob</PackageTags>
1212
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1313
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1414
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1515
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1616
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
18-
<Version>2.0.0-alpha2</Version>
18+
<Version>2.0.1-alpha3</Version>
1919
<FileVersion>2.0.0.0</FileVersion>
2020
</PropertyGroup>
2121
<ItemGroup>
2222
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />
2323
</ItemGroup>
24-
<ItemGroup>
25-
<Folder Include="Properties\" />
26-
</ItemGroup>
2724
<ItemGroup>
2825
<PackageReference Include="WindowsAzure.Storage" Version="8.4.0" />
2926
</ItemGroup>

SharpRepository.AzureDocumentDb/SharpRepository.AzureDocumentDb.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard1.5</TargetFrameworks>
44
<Product>SharpRepository for AzureDocumentDb</Product>
55
<Authors>Ben Griswold, Jeff Treuting</Authors>
66
<Description>SharpRepository is a generic repository</Description>
77
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
88
<PackageId>SharpRepository.AzureTableRepository</PackageId>
9-
<PackageVersion>2.0.0-alpha2</PackageVersion>
10-
<PackageReleaseNotes>2.0.0-alpha2: merge all code</PackageReleaseNotes>
9+
<PackageVersion>2.0.1-alpha3</PackageVersion>
10+
<PackageReleaseNotes>2.0.1-alpha3: configurable via appsettings.json</PackageReleaseNotes>
1111
<PackageTags>SharpRepository Repository Azure DocumentDb</PackageTags>
1212
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1313
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1414
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1515
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1616
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
18-
<Version>2.0.0-alpha2</Version>
18+
<Version>2.0.1-alpha3</Version>
1919
<FileVersion>2.0.0.0</FileVersion>
2020
</PropertyGroup>
2121
<ItemGroup>
2222
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />
2323
</ItemGroup>
24-
<ItemGroup>
25-
<Folder Include="Properties\" />
26-
</ItemGroup>
2724
<ItemGroup>
2825
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="1.4.0" />
2926
<PackageReference Include="Nito.AsyncEx.Tasks" Version="1.1.0" />

SharpRepository.AzureTableRepository/SharpRepository.AzureTableRepository.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard1.5</TargetFrameworks>
44
<Product>SharpRepository for AzureTable</Product>
55
<Authors>Ben Griswold, Jeff Treuting</Authors>
66
<Description>SharpRepository is a generic repository</Description>
77
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
88
<PackageId>SharpRepository.AzureTableRepository</PackageId>
9-
<PackageVersion>2.0.0-alpha2</PackageVersion>
10-
<PackageReleaseNotes>2.0.0-alpha2: merge all code</PackageReleaseNotes>
9+
<PackageVersion>2.0.1-alpha3</PackageVersion>
10+
<PackageReleaseNotes>2.0.1-alpha3: configurable via appsettings.json</PackageReleaseNotes>
1111
<PackageTags>SharpRepository Repository Azure Table</PackageTags>
1212
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1313
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1414
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1515
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1616
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
18-
<Version>2.0.0-alpha2</Version>
19-
<FileVersion>2.0.0.0</FileVersion>
18+
<Version>2.0.1-alpha3</Version>
2019
</PropertyGroup>
2120
<ItemGroup>
2221
<PackageReference Include="Microsoft.Azure.KeyVault" Version="2.3.2" />
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard1.3;netstandard1.5;netstandard1.6;netstandard2.0</TargetFrameworks>
3+
<TargetFrameworks>netstandard1.3</TargetFrameworks>
44
<Product>SharpRepository for a Cache Repository</Product>
55
<Authors>Ben Griswold, Jeff Treuting</Authors>
66
<Description>SharpRepository is a generic repository</Description>
77
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
88
<PackageId>SharpRepository.CouchDbRepository</PackageId>
9-
<PackageVersion>2.0.0-alpha2</PackageVersion>
10-
<PackageReleaseNotes>2.0.0-alpha2: merge all code</PackageReleaseNotes>
11-
<PackageTags>SharpRepository Repository CouchDbRepository CouchDb Couch</PackageTags>
9+
<PackageVersion>2.0.1-alpha3</PackageVersion>
10+
<PackageReleaseNotes>2.0.1-alpha3: configurable via appsettins.json</PackageReleaseNotes>
11+
<PackageTags>SharpRepository Repository Cache MemoryCache</PackageTags>
1212
<PackageIconUrl>https://user-images.githubusercontent.com/6349515/28491142-7b6350c4-6eeb-11e7-9c5b-e3b8ef1e73b8.png</PackageIconUrl>
1313
<PackageProjectUrl>https://github.com/SharpRepository/SharpRepository</PackageProjectUrl>
1414
<PackageLicenseUrl>https://raw.githubusercontent.com/SharpRepository/SharpRepository/master/license.txt</PackageLicenseUrl>
1515
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1616
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
18-
<Version>2.0.0-alpha2</Version>
19-
<FileVersion>2.0.0.0</FileVersion>
18+
<Version>2.0.1-alpha3</Version>
2019
</PropertyGroup>
2120
<ItemGroup>
2221
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
@@ -25,7 +24,4 @@
2524
<ItemGroup>
2625
<ProjectReference Include="..\SharpRepository.Repository\SharpRepository.Repository.csproj" />
2726
</ItemGroup>
28-
<ItemGroup>
29-
<Folder Include="Properties\" />
30-
</ItemGroup>
3127
</Project>

SharpRepository.Caching.Redis/SharpRepository.Caching.Redis.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
22
<PropertyGroup>
3-
<TargetFrameworks>netstandard2.0;netstandard1.6;netstandard1.5</TargetFrameworks>
3+
<TargetFrameworks>netstandard2.0;netstandard1.5</TargetFrameworks>
44
<Authors>Ben Griswold, Jeff Treuting</Authors>
55
<Description>SharpRepository is a generic repository</Description>
66
<Summary>Written in C#, includes support for various relational, document and object databases including Entity Framework, RavenDB, MongoDB, CouchDB and Db4o. SharpRepository includes Xml and InMemory repository implementations as well. SharpRepository offers built-in caching options for AppFabric, memcached and the standard System.Runtime.Caching. SharpRepository also supports Specifications, FetchStrategies, Batches and Traits!</Summary>
@@ -14,7 +14,7 @@
1414
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1515
<RepositoryUrl>https://github.com/SharpRepository/SharpRepository.git</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>2.0.0-alpha2</Version>
17+
<Version>2.0.1-alpha3</Version>
1818
</PropertyGroup>
1919
<ItemGroup>
2020
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "wwwroot/lib"
3+
}
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Http;
6+
using Microsoft.AspNetCore.Mvc;
7+
using SharpRepository.Repository;
8+
using SharpRepository.CoreWebClient.Models;
9+
10+
namespace SharpRepository.CoreWebClient.Controllers
11+
{
12+
public class ContactsController : Controller
13+
{
14+
protected IRepository<Contact, int> repository;
15+
16+
public ContactsController(IRepository<Contact, int> repository)
17+
{
18+
this.repository = repository;
19+
}
20+
21+
// GET: Contacts
22+
public ActionResult Index()
23+
{
24+
var contacts = repository.GetAll();
25+
26+
return View(contacts);
27+
}
28+
29+
// GET: Contacts/Details/5
30+
public ActionResult Details(int id)
31+
{
32+
var contact = repository.Get(id);
33+
34+
return View(contact);
35+
}
36+
37+
// GET: Contacts/Create
38+
public ActionResult Create()
39+
{
40+
return View();
41+
}
42+
43+
// POST: Contacts/Create
44+
[HttpPost]
45+
[ValidateAntiForgeryToken]
46+
public ActionResult Create(Contact contact)
47+
{
48+
try
49+
{
50+
repository.Add(contact);
51+
52+
return RedirectToAction(nameof(Index));
53+
}
54+
catch
55+
{
56+
return View();
57+
}
58+
}
59+
60+
// GET: Contacts/Edit/5
61+
public ActionResult Edit(int id)
62+
{
63+
var contact = repository.Get(id);
64+
return View(contact);
65+
}
66+
67+
// POST: Contacts/Edit/5
68+
[HttpPost]
69+
[ValidateAntiForgeryToken]
70+
public ActionResult Edit(int id, Contact contact)
71+
{
72+
try
73+
{
74+
repository.Update(contact);
75+
76+
return RedirectToAction(nameof(Index));
77+
}
78+
catch
79+
{
80+
return View(contact);
81+
}
82+
}
83+
84+
// GET: Contacts/Delete/5
85+
public ActionResult Delete(int id)
86+
{
87+
var contact = repository.Get(id);
88+
89+
return View(contact);
90+
}
91+
92+
// POST: Contacts/Delete/5
93+
[HttpPost]
94+
[ValidateAntiForgeryToken]
95+
public ActionResult Delete(int id, IFormCollection collection)
96+
{
97+
try
98+
{
99+
repository.Delete(id);
100+
101+
return RedirectToAction(nameof(Index));
102+
}
103+
catch
104+
{
105+
return View();
106+
}
107+
}
108+
}
109+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using SharpRepository.CoreWebClient.Models;
8+
using Microsoft.Extensions.Caching.Memory;
9+
using SharpRepository.Repository;
10+
11+
namespace SharpRepository.CoreWebClient.Controllers
12+
{
13+
public class HomeController : Controller
14+
{
15+
protected ITitle title;
16+
17+
public HomeController(ITitle title)
18+
{
19+
this.title = title;
20+
}
21+
22+
public IActionResult Index()
23+
{
24+
return View();
25+
}
26+
27+
public IActionResult About()
28+
{
29+
ViewData["Message"] = title.GetTitle() + ": Your application description page.";
30+
31+
return View();
32+
}
33+
34+
public IActionResult Contact()
35+
{
36+
ViewData["Message"] = title.GetTitle() + ": Your contact page.";
37+
38+
return View();
39+
}
40+
41+
public IActionResult Error()
42+
{
43+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
44+
}
45+
}
46+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
6+
namespace SharpRepository.CoreWebClient.Models
7+
{
8+
public class Contact
9+
{
10+
public int Id { get; set; }
11+
public string Name { get; set; }
12+
public virtual ICollection<Email> Emails { get; set; }
13+
}
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SharpRepository.CoreWebClient.Models
2+
{
3+
public class Email
4+
{
5+
public int Id { get; set; }
6+
public string EmailAddress { get; set; }
7+
}
8+
}

0 commit comments

Comments
 (0)