This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S.No Description | |
1 ConfigureServices Method should be as lean as possible. Create an extension class with the static method. then just to call this extended method upon the IServiceCollection type | |
2 DAL should be created as a separate service. With DAL as a separate service we can register it inside the IOC (Inversion of Control) container. | |
3 The repository logic should always be based on interfaces | |
4 The controllers shouldn’t have any business logic inside it. | |
5 Actions should always be clean and simple. Actions should have IActionResult as a return type in most of the cases. That way we can use all the methods inside .NET Core which returns results and the status codes as well. | |
6 Handle errors globally as much as possible using built-in and ready to use middleware or custom middleware. Add that exception middleware in the Startup class by modifying the Configure method | |
7 Use ActionFilters to Remove Duplicated Code | |
8 Separate entities that communicate with the database from the entities that |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#By default in asp.net core 3.0 razor views runtime compilation is disabled . See why and how we need to enable this razor runtime compilation | |
#After we enable the runtime compilation we need not to recompile the program again. By saving and refreshing the browser we can easily see the new changes. | |
#How to overcome from this problem. | |
#Solution - You need to install the nuget package i.e | |
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if you want your migration in different assembly and your DbContext lies in different project, then you can use the strategy to maintain multiple sets of migrations | |
#As a example, you have ASP.Net Core MVC project Named - AspNetCoreDemo.Web and AspNetCoreDemo.Migrations library | |
#Open Startup File in "AspNetCoreDemo.Web" add the below code in ConfigureServices method | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddDbContext<AppDBContext>(options => | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ItemGroup> | |
<None Update="hotlinkingURLRewrite.xml"> | |
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
</None> | |
</ItemGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@baseUrl = https://jsonplaceholder.typicode.com/todos/1 | |
GET {{baseUrl}} | |
Accept: application/json | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Common | |
{ | |
public const string EndpointUrl = "https://<your-account>.documents.azure.com:443/"; | |
public const string AuthorizationKey = "<your-account-key>"; | |
public const string DatabaseId = "FamilyDatabase"; | |
public const string ContainerId = "FamilyContainer"; | |
public const string employeesPartitionKey = "/department"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Solution 1. Open AndroidManifest file. | |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest ...> | |
<uses-permission android:name="android.permission.INTERNET" /> | |
<application | |
... | |
android:usesCleartextTraffic="true" | |
...> | |
... | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 . cd c:/program files/docker/docker | |
.\dockercli -Version | |
TO check the CLI vrsion | |
2. docker image ls - List out the images from docker host | |
3. docker container ls - list out the active container | |
4. docker system info | |
5. docker-compose --version | |
6. docker-machine --version | |
7. notary --version | |
8. docker container run -it ubuntu:latest /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//UnitConverterPageViewModel | |
private string _kilometers; | |
public string Kilometers | |
{ | |
get { return _kilometers; } | |
set | |
{ | |
SetProperty(ref _kilometers, value); |