Showing posts from August, 2021

How to use View Components In ASP.NET Core 5.0 MVC?

  View Components In ASP.NET Core 5.0 MVC The concept of ViewComponet in Asp.Net Core 5 MVC is very similar to a PartialView but it has more potential in it.  ViewComponet renders a small chunk of view which is not a part of the controller or the HTTP life cycle.  Typical usage Additonal product suggestions Extra navigation menu Recently added posts  A Small notice that has to be rendered in every page Sidebar content How to create a ViewComponent? Derive a class from ViewComponent public class Options : ViewComponent { } C# Copy Decorate the class using [ViewComponent] attribute [ ViewComponent ( Name = "Options" ) ] public class Options : ViewComponent { public IViewComponentResult Invoke ( ) { return View ( ) ; } } C# Copy Name the class ViewComponent as subfix public class OptionsViewComponent : ViewComponent { public IViewComponentResult Invoke ( ) { return View ( ) ; } } C# Copy View search path The runti

Change the Primary Key for User table in Asp.NET Core Identity

  Change the Primary Key for User table in Asp.NET Core Identity Goal Here we will change the default primary key for the user table Asp.Net Core Identity in .NET 5. We will change the primary key from string to int. Please use this when you are using a developement database. This tutorial uses .NET 5 and EF Core 5.0.8 Create a new project Create a new project of type ASP.NET Core 5.0 with enabling authentication type as Individual Accounts. When we are trying to customizing things in the Identity framework we may need to add new fields , change the default design and much more. The Identityframework uses Code first approach so we can customize more. For this project I will use SQLite with EntityFrameworkCore version 5.0.8 but you can use SQL Server or any. Remove the migration Use the command remove-migration to remove the default created Migration remove-migration Bash Copy Add a new Class named AppUser Inheriting from identityUser public class AppUser : IdentityUser < int >

Making my Own Expense Tracker WebApp

 My Own Expense Tracker - Sonic Ledger I made a expense tracker management software. I call this as Sonic Ledger. This helps you to track your expenses and store personal notes. Here you can store your financial transactions. Deposit or spend is there with variety of categorization like entertainment, food, shopping etc.  The Home dash board shows you a doughnut for your expense and deposit. It also helps you see your deposits , spends and spends classified in categories in the form of bar charts. Features as per V 2.0 1.Multiple ledgers/Account support 2.Personal Notes/Blogs 3. Doughnut, Bar charts for deposits and expense overview 4. Identity Auth service with 2FA support 5. Expense categorization This application is built using .NET 5 MVC. It uses ChartJs library for chart visualization pages. This uses SQLite database but it can be configured to work with Microsoft SQL Server or Postgres or My SQL as it uses the popular Micro ORM Dapper and ORM Entity Framework Core 5. It is quite

SurfaceR - Mobile gyroscope synced with an 3D HTML Object

 Idea The main idea is to communicate in real time with SignalR with ASP.NET Core. In realtime mobile orientation data is exchanged with the connected clients. There is also a remote embedded into the website. For now this only runs on the Android Mozilla Firefox. Action Page The 3D model is made with HTML5 and CSS3. The X,Y and Z orientation is changed with the realtime data with orientation of the phone or the remote given. Its an open source project so feel free to contribute. Source Code at GitHub How does it work? Step-1 You open the website and click on "See In Action" It opens up an image which changes it's orientation. Step -2 There is two way to change the orientation of the image. You open up the same website in an another device and click on the "Controls". As you change th e orientation using the Axes controllers or the Gyroscope controllers the image will change its orientation. You download the SurfaceR Android or iOS app and then turn on the butto