Posts

Donate

Getting Started With Bootstrap-Table In An ASP.NET Core MVC 5 Web Application With Entity Framework Core And SQL Server

Image
Hello, In this tutorial, I will demonstrate on how to integrate Bootstrap-Table created by Wenzhixin in an ASP.NET Core MVC 5 with Entity Framework Core and SQL Server. For this post, I'll be using Microsoft's free database called ContosoRetailDW. Most of the ASP.NET MVC 5 web project in our company use this widget for showing records to clients because this has tons of features like exporting, paging, searching, sorting by column names and a whole lot more and this awesome widget has been constantly improved by the product owner and some dedicated developers. Project Setup 1. Lets start by creating an ASP.NET Core MVC application targeting the latest framework which is .NET 5 using Visual Studio 2019. 2. Add these NuGet packages for Entity Framework Core and ASP.NET Core MVC Newtonsoft.Json 3. Next is to reverse engineer the ContosoRetailDW so that we can use it's tables. The bootstrap-table widget will load records from DimPromotions table. Scaffold-DbContext "

Using Unity IoC Container Dependency Injection, Dapper ORM and SQL Server In Visual Basic .NET Core Or .NET 5 Application

Image
Hi All, This article is the VB.NET version of this post Getting Started With Unity IoC Container Dependency Injection In .NET Core Using Entity Framework Core ORM And SQL Server . We will create a .NET Core Console Application that will utilize the Unity IoC Container for Dependency Injection, SQL Server and Dapper ORM. Instead of using Entity Framework, I'm using Dapper ORM coz EF does not support reverse engineering in .NET Core. There are existing power tools or other solutions on how to reverse engineer a database table but for now I'll just use Dapper. I'll be using Microsoft's sample database called ContosoRetailsDw as the datasource of this tutorial. Project Setup 1. Start off by creating a Visual Basic .NET Core Console Application targetting the latest framework which is .NET 5.0 2. Add three new folders Models, Repository and UnitOfWork. These folders contain the model and DAL classes used in this project. 3. Add the following NuGet packages: Dapper O

Generic Method With BitConverter.GetBytes() Throws Error: CS1503 Argument 1: cannot convert from 'T' to 'bool'

Image
Hello And Good Day! There was a post in VBForums Generic Method with BitConverter.GetBytes problem on how to pass a T variable without causing the issue CS1503 Argument 1: cannot convert from 'T' to 'bool' private static byte [] GetBytes<T> (T valu) { var bytes = BitConverter.GetBytes(valu); if (BitConverter.IsLittleEndian) Array.Reverse(bytes); return bytes; } Since Generic Constraints for a numeric types isn't available at this time, I attempted to solve this issue by checking the type of T and then perform the conversion explicity. private static byte [] GetBytes<T>(T value ) { byte [] bytes; ushort val1; uint val2; Type t = typeof (T); if (t == typeof ( ushort )) { val1 = Convert.ToUInt16( value ); bytes = BitConverter.GetBytes(val1); } else if (t == t

How To Create Or Generate PDF Reports Or Files Using DinkToPDF in .NET 5 or .NET Core Console Application

Image
Good day! In this tutorial, I will demonstrate on how to create or generate PDF reports or files using DinkToPDF in .NET 5 or .NET Core Console Application. This library is a C# .NET Core wrapper for wkhtmltopdf library that uses the Webkit engine to convert HTML files or page to PDF and was developed by 'rdvojmoc Rok Dvojmoč' from Slovenia. To begin with lets start by establishing the project structure. Project Structure 1. Create a .NET 5 or .NET Core Console Application Project. 2. Add DinkToPDF and Unity packages using NuGet. 3. Copy the libwkhtmltox (dll, dylib and so) files from DinkToPDF and attach those files to your project. Make sure to set the Copy to Output Directory attribute of those files to Copy Always . Note that there are two versions for these files,32 and 64 bit. 4. Create three folders to the project and in each folder add the empty classes or interface shown in step #6. 5. Add an empty html file called ReportTemplate inside the project and set

Using Microsoft.Extensions.DependencyInjection In .NET 5 or .NET Core Console Application

Image
Team, Here's how to incorporate the Microsoft.Extensions.DependencyInjection namespace and it's ServiceProvider class in a .NET 5 or .NET Core Console Application project. If you're an ASP.NET Core MVC developer, you might recognize how it is applied in Startup.cs for Dependency Injection specifically ConfigureServices() method wherein the AddTransient() method is utilized to map an interface class and it's implementation type. To begin with, lets by creating a .NET 5 Console application project and follow the steps below. Project Setup 1. Add the Microsoft.Extensions.DependencyInjection package to your project via NuGet. 2. Create three folders, new classes and interfaces based from the image below. Models Add two model classes specifically Employee and Product with three properties for each class. Product.cs public class Product { public int ProductCode { get ; set ; } public string ProductName { get ; set ; } public double Prod

Sharkoon SKILLER SGS2 Gaming Chair Product Review

Image
Team, A week ago,I decided to purchase a gaming chair at a local computer shop in one of the malls here in Cebu since the piston of my old office chair does not work anymore. I did canvass at several stores but I'm not amazed by the brands that they were selling.While most of the chairs' upholstery that were presented to me were made of leather, the Sharkoon SKILLER SGS2 Gaming Seat was made of fabric and the price is just within my budget. That's why I decided to purchase this item. The main features of Sharkoon SKILLER SGS2 Gaming Chair based from the main website Sharkoon SKILLER SGS2 Gaming Chair are: A. Breathable and Supple - which describes the upholstery that is entirely made of soft fabric. B. Versatility through Adjustability - denotes the adjustable backrest, ergonomic posture, 3D armrest and seating height. C. Comfortable Extras - these extras include suspension and tilt control system, large 60 mm wheels and a backrest which can be reclined and locked

How To Persist Input Control Values In Bootstrap-Table On Paging, Filtering And Searching In ASP.NET MVC

Image
Team, When working with the Bootstrap-Table by Wenzhixin in a specific project, I encountered an issue which is the value of input controls such as checkbox and textbox were lost when I performed searching, filtering or pagination of the Bootstrap-Table. I tried several solutions presented in github and the documentation such as setting the properties of data-maintain-meta-data or data-maintain-selected to true and much more. After a few hours, I did found the solution in the documentation which is Saving Row Data Using Input . The solution is to fetch the current value of the control and call Bootstrap-Table updateRow method to preserve the values. The entire page is shown below including it's JavaScript code. @{ ViewBag.Title = "Home Page"; } <div class= "row" > <div id= "divPeople" class= "col-md-12" > <div class= "table-responsive" > <table id= "tblPeople"

Donate