https://github.com/birajmainali/dotnet-web-template
.NET core web application template with pre-builds, Use this template and deep dive into your product requirement rather then initial setup's.
https://github.com/birajmainali/dotnet-web-template
custom-authentication dotnet-core dotnet-core-8 easy-repo web-app-template
Last synced: about 1 year ago
JSON representation
.NET core web application template with pre-builds, Use this template and deep dive into your product requirement rather then initial setup's.
- Host: GitHub
- URL: https://github.com/birajmainali/dotnet-web-template
- Owner: BirajMainali
- Created: 2022-09-08T13:42:05.000Z (almost 4 years ago)
- Default Branch: develop
- Last Pushed: 2024-02-13T15:30:40.000Z (over 2 years ago)
- Last Synced: 2025-05-12T22:53:49.012Z (about 1 year ago)
- Topics: custom-authentication, dotnet-core, dotnet-core-8, easy-repo, web-app-template
- Language: JavaScript
- Homepage:
- Size: 6.07 MB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# .NET Core Web App Template
## Pre-build's
* Generic Repository, Just inject IRepository to get started.
```csharp
IRepository userRepository
```
* Register your services into Dependencies with marks
```csharp
public interface IUserValidator : IScopedDependency // We have other too.
{
Task EnsureUniqueUserEmail(string email, long? id = null);
}
```
* Add your database Entity
```csharp
public class AppUser : FullAuditedEntity
{
// props.
}
```
* Unit Of work
```csharp
public class UserService(IUserValidator userValidator, IUow uow) : IUserService
{
public async Task CreateUser(UserDto dto)
{
using var tsc = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled);
var user = new AppUser();
await uow.CreateAsync(user);
await uow.CommitAsync();
tsc.Complete();
return user;
}
```
* Nepali Date, Importantly mentioned implementation show nepali but send English date request.
```html
// display nepali date.
// nepali date input
```
* To current user information, We have `ICurrentUserProvider`
```csharp
public interface ICurrentUserProvider
{
bool IsLoggedIn();
Task GetCurrentUser();
long? GetCurrentUserId();
string GetCurrentConnectionKey();
}
```
* Multi-tenant Configuration `appsetting.json`. Physical separation is been used.
```json
"UseMultiTenancy": true, you can control tenant from here.
```
* App-setting configurations
```csharp
IOptions options
```
* Use Serilog
```csharp
ILogger logger
Log.Error(e, "Error while getting tenant");
```
* Resolve http response
```csharp
[Route("WhatIsMyTenant")]
public IActionResult WhatIsMyTenant()
{
try
{
var connectionKey = _currentUserProvider.GetCurrentConnectionKey();
return this.SendSuccess("Success", connectionKey); // here
}
catch (Exception e)
{
Log.Error(e, "Error while getting tenant");
return this.SendError(e.Message); // here
}
}
```
## Others
* Swagger `/Swagger`
* Logs `./Logs`
* Use of custom authentication including jwt and cookie.
* Physical content can saved outside application scope.
* Explore `FileHelper` to work with physical file.
* Check `IDatabaseConnectionProvider` to create new dapper connection.
* Used `tabler` theme