<?xml version="1.0" encoding="UTF-8" standalone="no"?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><title>Discuss dotnet</title><description>Muhammad Idrees has shared his knowledge and skills throughout his experience in dotnet technology. Subscribe to stay in touch with latest updates in this feed.</description><managingEditor>noreply@blogger.com (Muhammad Idrees)</managingEditor><pubDate>Wed, 15 Apr 2026 17:15:11 +0500</pubDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">258</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">25</openSearch:itemsPerPage><link>http://idreesdotnet.blogspot.com/</link><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle>A place to share what I'm learning | .Net Core, Python, PHP, Angular and more...</itunes:subtitle><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><xhtml:meta content="noindex" name="robots" xmlns:xhtml="http://www.w3.org/1999/xhtml"/><item><title>CSS Properties - Inherit, Initial and Unset Values </title><link>http://idreesdotnet.blogspot.com/2024/04/css-properties-inherit-initial-unset.html</link><category>CSS</category><category>HTML5</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 30 Apr 2024 01:02:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-2495326021755244752</guid><description>

&lt;p&gt;
All CSS properties have 3 basic values in common: inherit, initial and unset. 
&lt;/p&gt;

&lt;p&gt;
Here is quick summary for these values:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;initial&lt;/code&gt;: The default value for the property (the browser default).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;inherit&lt;/code&gt;: Get the property from the parent element.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;unset&lt;/code&gt;: Acts as either inherit or initial. It’ll act as inherit if the parent has a value that matches, or else it will act as initial.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
Example CSS:
&lt;/h3&gt;

&lt;pre class="brush: xml;"&gt;
    &amp;lt;style&amp;gt;
        div {
            color: red;
            font-size:larger;
        }

        .some-design {
            color: blue;
        }

        .unset {
            color: unset;
        }

        .initial {
            color: initial;
        }
    &amp;lt;/style&amp;gt;
&lt;/pre&gt;

&lt;h3&gt;
Example HTML:
&lt;/h3&gt;

&lt;pre class="brush: xml;"&gt;
    &amp;lt;div&gt;
        &amp;lt;div&amp;gt;Text in this (parent) div element is red.&amp;lt;/div&amp;gt;
        &amp;lt;div class="some-design"&amp;gt;This div's css make it blue.&amp;lt;/div&amp;gt;
        &amp;lt;div class="unset"&amp;gt;(color =&gt; unset): The color is unset 
             (red, because it is inherited from the parent div).&amp;lt;/div&amp;gt;
        &amp;lt;div class="initial"&amp;gt;(color =&gt; initial): The color is initial 
             (black, the browser default).&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
It will display the output like:
&lt;/p&gt;

&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPEIXqxgnvenple5aK00G9qOpb1ZRfXjcUxC8E85X_Kb9wwSRQLOPDzjE-kFCZYjuLz7ElmurtAQJVJ9deRPG7eslmXNSd5HcvqmFRitJdsy2FkKFMtOdHx_cq-FpNUN6RrBXNbqzPTLpXZZFSW7kepmfMumbLAdPH4PpGp81RHO77AYnyMaskK8ZOORL5/s980/P1108-inherit-initial-unset-css-display.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="600" data-original-height="163" data-original-width="980" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPEIXqxgnvenple5aK00G9qOpb1ZRfXjcUxC8E85X_Kb9wwSRQLOPDzjE-kFCZYjuLz7ElmurtAQJVJ9deRPG7eslmXNSd5HcvqmFRitJdsy2FkKFMtOdHx_cq-FpNUN6RrBXNbqzPTLpXZZFSW7kepmfMumbLAdPH4PpGp81RHO77AYnyMaskK8ZOORL5/s600/P1108-inherit-initial-unset-css-display.png"/&gt;&lt;/a&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgPEIXqxgnvenple5aK00G9qOpb1ZRfXjcUxC8E85X_Kb9wwSRQLOPDzjE-kFCZYjuLz7ElmurtAQJVJ9deRPG7eslmXNSd5HcvqmFRitJdsy2FkKFMtOdHx_cq-FpNUN6RrBXNbqzPTLpXZZFSW7kepmfMumbLAdPH4PpGp81RHO77AYnyMaskK8ZOORL5/s72-c/P1108-inherit-initial-unset-css-display.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>JS Geolocation API – Use watchPosition()</title><link>http://idreesdotnet.blogspot.com/2024/04/js-geolocation-api-use-watchposition.html</link><category>HTML5</category><category>JavaScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 30 Apr 2024 00:28:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-1260063282476053244</guid><description>	
&lt;p&gt;
The &lt;code&gt;watchPosition()&lt;/code&gt; method of the Geolocation interface is used to register a handler function that will be called automatically each time the position 
of the device changes. You can also, optionally, specify an error handling callback function.
&lt;/p&gt;

&lt;p&gt;
This method retrieves periodic updates about the current geographic location of the device, allows to detect a change in position of device.
The location object contains geographic coordinates with information about speed.
&lt;/p&gt;

&lt;p&gt;
Like we have 3 parameters in &lt;code&gt;getCurrentPosition()&lt;/code&gt; method, &lt;code&gt;watchPosition()&lt;/code&gt; accepts the same:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;success&lt;/code&gt;: A callback function that retrieves the location information.
&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;error&lt;/code&gt; (Optional): An optional callback function that takes a GeolocationPositionError object as an input parameter.
&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;options&lt;/code&gt; (Optional): This optional parameter specifies a set of options for retrieving the location information. 
&lt;p&gt;
You can specify:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Accuracy of the returned location information&lt;/li&gt;
&lt;li&gt;Timeout for retrieving the location information&lt;/li&gt; 
&lt;li&gt;Use of cached location information&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;code&gt;Return value&lt;/code&gt;: An integer ID that identifies the registered handler. 
The ID can be passed to the &lt;code&gt;Geolocation.clearWatch()&lt;/code&gt; to unregister the handler and stop receiving location updates.

&lt;h3&gt;Example Code:&lt;/h3&gt;

&lt;pre class="brush: xml;"&gt;
function onSuccess(position) {
	//do something with position data.
	console.log("Latitude: " + position.coords.latitude);
	console.log("Longitude: " + position.coords.longitude);
}

function onError(error) {
  switch(error.code) {
    case error.PERMISSION_DENIED:
      console.log("User denied the request for Geolocation.");
      break;
    case error.POSITION_UNAVAILABLE:
      console.log("Location information is unavailable.");
      break;
    case error.TIMEOUT:
      console.log("The request to get user location timed out.");
      break;
    case error.UNKNOWN_ERROR:
      console.log("An unknown error occurred.");
      break;
  }
}

// Options: throw an error if no update is received every 30 seconds.
var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 });
&lt;/pre&gt;


&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/03/js-geolocation-api-get-users-location.html" target="_blank"&gt;
JS Geolocation API – Get a User's Location
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/03/use-getcurrentposition-with-options.html" target="_blank"&gt;
JS Geolocation API – getCurrentPosition with options parameter
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total></item><item><title>JS Geolocation API – getCurrentPosition with options parameter</title><link>http://idreesdotnet.blogspot.com/2024/03/use-getcurrentposition-with-options.html</link><category>HTML5</category><category>JavaScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Thu, 21 Mar 2024 12:00:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-4602059370757447927</guid><description>&lt;p&gt;
In the last post 
&lt;a href="https://idreesdotnet.blogspot.com/2024/03/js-geolocation-api-get-users-location.html" target="_blank"&gt;
  &lt;code&gt;
	(JS Geolocation API – Get a User's Location)
	&lt;/code&gt;
&lt;/a&gt;
 
we have covered &lt;code&gt;navigator.geolocation.getCurrentPosition()&lt;/code&gt; method to get user's location. We have used the success and error callbacks to 
receive the position object or report error.
&lt;/p&gt;

&lt;p&gt;
The method &lt;code&gt;getCurrentPosition()&lt;/code&gt; also accepts an &lt;code&gt;options&lt;/code&gt; object as third paramter (optional).
&lt;/p&gt;

&lt;p&gt;
This &lt;code&gt;options&lt;/code&gt; object allows you to specify:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;enableHighAccurancy&lt;/code&gt; (default false): if set to true, response is slower and more accurate.
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;maximumAge&lt;/code&gt; (default 0): milliseconds when cached value is valid, the device may decide to use valid cached data instead of sensor measure.
Represents age for the returned position value (up until this age it will be cached and reused if the same position is requested again,
after this the browser will request fresh position data)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;timeout&lt;/code&gt; (default infinity): milliseconds before the API gives up and calls the error handler (the second parameter).
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
The example below calls &lt;code&gt;getCurrentPosition()&lt;/code&gt; with both success and error callbacks, and pass the &lt;code&gt;options&lt;/code&gt; object in third argument:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
var options = {
  enableHighAccuracy: true,
  timeout: 5000, //timeout 5 seconds
  maximumAge: 10000 //(location) age 10 seconds
};

navigator.geolocation.getCurrentPosition(success, error, options);
&lt;/pre&gt;


&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/03/js-geolocation-api-get-users-location.html" target="_blank"&gt;
JS Geolocation API – Get a User's Location
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total></item><item><title>JS Geolocation API – Get a User's Location</title><link>http://idreesdotnet.blogspot.com/2024/03/js-geolocation-api-get-users-location.html</link><category>HTML5</category><category>JavaScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Thu, 21 Mar 2024 11:31:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-439309533750080238</guid><description>
&lt;p&gt;
The JavaScript Geolocation API provides access to geographical location data associated with a user's device. 
This can be determined using GPS, WIFI, IP Geolocation and so on.
&lt;/p&gt;

&lt;p&gt;
Geolocation is most accurate for devices with GPS, like smartphones.
&lt;/p&gt;

&lt;p&gt;
To protect the user's privacy, it requests permission to locate the device. If the user grants permission, 
you will gain access to location data such as latitude, longitude, altitude and speed etc.
&lt;/p&gt;

&lt;p&gt;
The Geolocation API is available through the &lt;code&gt;navigator.geolocation&lt;/code&gt; object.
&lt;/p&gt;

&lt;p&gt;
If the object exists, geolocation services are available. You can test for the presence of geolocation:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
if ("geolocation" in navigator) {
  console.log("geolocation is available");
} else {
  console.log("geolocation is not available");
}
&lt;/pre&gt;

&lt;p&gt;
&lt;code&gt;navigator.geolocation&lt;/code&gt; object provides the method &lt;code&gt;getCurrentPosition()&lt;/code&gt; to return the user's position.
&lt;/p&gt;

&lt;p&gt;
There are three possible arguments with this method:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
A success callback (required)
&lt;/li&gt;
&lt;li&gt;
An error callback (optional)
&lt;/li&gt;
&lt;li&gt;
An options object (optional)
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
The example below calls &lt;code&gt;getCurrentPosition()&lt;/code&gt; with both success and error callbacks, and returns the &lt;code&gt;latitude&lt;/code&gt; and &lt;code&gt;longitude&lt;/code&gt; 
of the user's position:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(usePositionData, useError);
  } else {
    console.log("Geolocation is not supported by this browser.");
  }
}

function usePositionData(position) {
	//do something with position data.
	console.log("Latitude: " + position.coords.latitude);
	console.log("Longitude: " + position.coords.longitude);
}

function useError(error) {
  switch(error.code) {
    case error.PERMISSION_DENIED:
      console.log("User denied the request for Geolocation.");
      break;
    case error.POSITION_UNAVAILABLE:
      console.log("Location information is unavailable.");
      break;
    case error.TIMEOUT:
      console.log("The request to get user location timed out.");
      break;
    case error.UNKNOWN_ERROR:
      console.log("An unknown error occurred.");
      break;
  }
}
&lt;/pre&gt;


&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/03/use-getcurrentposition-with-options.html" target="_blank"&gt;
JS Geolocation API – getCurrentPosition with options parameter
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>CSS - Using media query features</title><link>http://idreesdotnet.blogspot.com/2024/02/css-using-media-query-features.html</link><category>CSS</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 27 Feb 2024 13:06:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-1666734414305228026</guid><description>
&lt;p&gt;
Media Query features define the style for specific characteristics of a given user agent, output device, or environment. 
&lt;/p&gt;

&lt;p&gt;
Media features can be either range or discrete.
&lt;/p&gt;

&lt;p&gt;
Discrete features take their value from an enumerated set of possible keyword values. 
For example, the discrete &lt;code&gt;orientation&lt;/code&gt; feature accepts either &lt;code&gt;landscape&lt;/code&gt; or &lt;code&gt;portrait&lt;/code&gt;.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
@media print and (orientation: portrait) {
  colod: red;
}
&lt;/pre&gt;

&lt;p&gt;
Many range features can be prefixed with &lt;code&gt;min-&lt;/code&gt; or &lt;code&gt;max-&lt;/code&gt; to express "minimum condition" or "maximum condition" constraints.
For example, this CSS will apply styles only if your browser's viewport width is equal to or narrower than 1000px:&lt;/p&gt;
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
@media (max-width: 1000px) {
  colod: blue;
}
&lt;/pre&gt;

&lt;p&gt;
An alternative syntax for above condition is to use ordinary mathematical comparison operators &lt;code&gt;&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;&lt;/code&gt;, &lt;code&gt;&amp;gt;=&lt;/code&gt;, or &lt;code&gt;&amp;lt;=&lt;/code&gt;.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
@media (width &amp;lt;= 1000px) {
  colod: blue;
}
&lt;/pre&gt;

&lt;p&gt;
&lt;code&gt;@media (width &amp;lt;= 1000px)&lt;/code&gt; is the equivalent of &lt;code&gt;@media (max-width: 1000px)&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
These are some other commonly used media features:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;orientation&lt;/code&gt;: Orientation of the viewport (landscape or portrait)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max-height&lt;/code&gt;: Maximum height of the viewport
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;min-height&lt;/code&gt;: Minimum height of the viewport
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;height&lt;/code&gt;: Height of the viewport (including scrollbar)
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max-width&lt;/code&gt;: Maximum width of the viewport
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;min-width&lt;/code&gt;: Minimum width of the viewport
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;width&lt;/code&gt;: Width of the viewport (including scrollbar)
&lt;/ul&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/02/css-using-media-queries.html" target="_blank"&gt;
CSS - Using media queries
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>CSS - Using media queries</title><link>http://idreesdotnet.blogspot.com/2024/02/css-using-media-queries.html</link><category>CSS</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 27 Feb 2024 12:00:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8164177050344145621</guid><description>&lt;p&gt;
Media queries allow you to conditionally apply CSS styles depending on a device's media type (such as &lt;code&gt;screen&lt;/code&gt;, &lt;code&gt;print&lt;/code&gt;). You can also specifiy other features 
or characteristics such as screen resolution or orientation etc.
&lt;/p&gt;

&lt;p&gt;
A media query is composed of an optional media type and any number of media feature expressions, which may be combined using logical operators. 
&lt;/p&gt;

&lt;p&gt;
Media types describe the general category of a given device, mainly we are using three basic types screen, print, and all.
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;screen&lt;/code&gt;: used for websites commonly designed (for computer screens, tablets, smart-phones etc).

&lt;pre class="brush: xml;"&gt;
@media screen {
  colod: red;
}
&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;print&lt;/code&gt;: used for printing (print preview mode)
&lt;pre class="brush: xml;"&gt;
@media print {
  colod: blue;
}
&lt;/pre&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;all&lt;/code&gt;: for all devies, there is no filter for any specific device category.
&lt;pre class="brush: xml;"&gt;
@media all {
  colod: green;
}
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;

The mediatype is optional (if omitted, it will be set to all).
&lt;pre class="brush: xml;"&gt;
@media {
  colod: green;
}
&lt;/pre&gt;

&lt;p&gt;
You can also target multiple devices types. For instance, this &lt;code&gt;@media&lt;/code&gt; rule uses two media queries to target both &lt;code&gt;screen&lt;/code&gt; and &lt;code&gt;print&lt;/code&gt; devices:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
@media screen, print {
  colod: green;
}
&lt;/pre&gt;
 

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2024/02/css-using-media-query-features.html" target="_blank"&gt;
CSS - Using media query features
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>git shows files as modified after adding to .gitignore</title><link>http://idreesdotnet.blogspot.com/2024/01/git-shows-files-as-modified-after.html</link><category>git</category><category>Visual Studio</category><category>Windows</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sun, 28 Jan 2024 23:24:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-74316873434740201</guid><description>&lt;p&gt;
In Visual Studio, once the .Net project is setup with git, you might notice that it will keep track for extra files, like autogenerated files in 
&lt;code&gt;obj&lt;/code&gt;/&lt;code&gt;debug&lt;/code&gt; folders.
&lt;/p&gt;

&lt;p&gt;
You can ignore these selected folders/files by using &lt;code&gt;.gitignore&lt;/code&gt; file.
&lt;/p&gt;

&lt;p&gt;
To ignore &lt;code&gt;debug&lt;/code&gt;, &lt;code&gt;release&lt;/code&gt;, &lt;code&gt;bin&lt;/code&gt; and &lt;code&gt;obj&lt;/code&gt; folders etc., you can make these entries in &lt;code&gt;.gitignore&lt;/code&gt; file.
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
[Dd]ebug/
[Rr]elease/
[Bb]in/
[Oo]bj/
&lt;/pre&gt;

&lt;p&gt;
After settings these changes you might notice that git is still tracking the files in these folders. 
&lt;/p&gt;
&lt;p&gt;
The reason is that these are the changes &lt;strong&gt;before&lt;/strong&gt; the &lt;code&gt;.gitignore&lt;/code&gt; file is updated.
&lt;/p&gt;

&lt;p&gt;
To fix this issue you need to removes all files that have been cached (as being 'tracked'), then re-add files based on the &lt;code&gt;.gitignore&lt;/code&gt; file entries.
&lt;/p&gt;

&lt;p&gt;
Here are the steps, notice the dot (&lt;code&gt;.&lt;/code&gt;) in the end of first 2 commands, this &lt;code&gt;.&lt;/code&gt; is part of command syntax:
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Remove all files recursively from index that are cached (being tracked).

&lt;pre class="brush: xml;"&gt;
git rm -r --cached .
&lt;/pre&gt;
&lt;p&gt;
&lt;code&gt;rm&lt;/code&gt; is to remove files, &lt;code&gt;-r&lt;/code&gt; is to remove recursively.
&lt;/p&gt;
&lt;/li&gt;

&lt;li&gt;
Add all files that have changed (re-add the files). This command will add all files except those which are mentioned in &lt;code&gt;.gitignore&lt;/code&gt;.

&lt;pre class="brush: xml;"&gt;
git add .
&lt;/pre&gt;

&lt;/li&gt;

&lt;li&gt;
This command will commit your files again and remove the files you want to ignore, but keep them in your local directory.

&lt;pre class="brush: xml;"&gt;
git commit -am "Remove ignored files"
&lt;/pre&gt;

&lt;/li&gt;

&lt;/ul&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>How to set up git server on local machine (Windows)</title><link>http://idreesdotnet.blogspot.com/2024/01/how-to-set-up-git-server-on-local.html</link><category>git</category><category>Windows</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sat, 27 Jan 2024 16:19:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8673036226693746810</guid><description>&lt;p&gt;
To configure git server on local windows machine, you can follow these steps:
&lt;/p&gt;

&lt;h3&gt;
Setup Git Server Repo:
&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
Go to folder, where you want to initialize the server, specify a name without spaces (else you will need to use quotes whenever accessing this folder)
&lt;/li&gt;
&lt;li&gt;
Open this folder in command prompt and type this command to initiate server repo.

&lt;pre class="brush: xml;"&gt;
//git init &amp;lt;repo-name&amp;gt;.git --bare

git init mylocalrepo.git --bare

&lt;/pre&gt;
&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToCOwPrTDmAAvwC78fSD_7a5bW5wz-uczQB9iBGMC_cxcFh6s1MNRbLqXYhpEbNlUWxrhJjyg5Ypiz5rj6gEWdXjUciSIeByJV74_WN-wLU6TbPIcZLgSrdB-JQQAwqZ4qNJNHn22xf0PMOqyRkq5cHli63O-OadoM-iiMZFLv65Ls-D7zmF8rpEaPLSb/s1017/P1107%20-%20git-init.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="600" data-original-height="94" data-original-width="1017" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToCOwPrTDmAAvwC78fSD_7a5bW5wz-uczQB9iBGMC_cxcFh6s1MNRbLqXYhpEbNlUWxrhJjyg5Ypiz5rj6gEWdXjUciSIeByJV74_WN-wLU6TbPIcZLgSrdB-JQQAwqZ4qNJNHn22xf0PMOqyRkq5cHli63O-OadoM-iiMZFLv65Ls-D7zmF8rpEaPLSb/s600/P1107%20-%20git-init.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
&lt;code&gt;mylocalrepo&lt;/code&gt; is the repository name.
&lt;/p&gt;
&lt;p&gt;
(Note: to avoid any issues later, its better to append the suffix '.git' to the repository name)
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
The git server repo is setup.
&lt;/p&gt;

&lt;h3&gt;
Setup Git Client/Clone:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
Go to the folder, where you want to initialize the client.
&lt;/li&gt;
&lt;li&gt;
Open this folder in command prompt and type this command to initiate client repo.

&lt;pre class="brush: xml;"&gt;
//git clone &amp;lt;path_to_your_server&amp;gt;

git clone C:\_Data\Test\GitServer\mylocalrepo.git
&lt;/pre&gt;

You may need to change the back-slash "\" to forward-slash "/" in the path.
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX_poMjB7zdmh3MU9AakofaxoSi5tqwFOIccvaQxHjV12ygO8S3BZ4plKLjyzh4feU3yHFWB5blEXYswJ3womlslnLWSi-5LOqADe4mpq_k98f5E9dFa2XTITXPnSuf4q7s8xBQsp7vRDkBh2bOo2RUeNjR3JeniEpjIjyRhYs4ReoZYafkGIESHVfsM3H/s906/P1107%20-%20git-clone.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="600" data-original-height="124" data-original-width="906" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgX_poMjB7zdmh3MU9AakofaxoSi5tqwFOIccvaQxHjV12ygO8S3BZ4plKLjyzh4feU3yHFWB5blEXYswJ3womlslnLWSi-5LOqADe4mpq_k98f5E9dFa2XTITXPnSuf4q7s8xBQsp7vRDkBh2bOo2RUeNjR3JeniEpjIjyRhYs4ReoZYafkGIESHVfsM3H/s600/P1107%20-%20git-clone.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
The client repo is setup. 
&lt;/p&gt;

&lt;p&gt;
You can try to make chages in client repo and push to git server.
&lt;/p&gt;

&lt;p&gt;
Manually create a new file (&lt;code&gt;readme.txt&lt;/code&gt;) in client folder, and make some changes.
&lt;/p&gt;

&lt;p&gt;
You can stage this file:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
git add .
&lt;/pre&gt;

&lt;p&gt;
Commit the changes with custom message:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
git commit -m "added readme file"
&lt;/pre&gt;

&lt;p&gt;
Push the changes to git server:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
git push
&lt;/pre&gt;
&lt;br&gt;

&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcRck9fm6xNOgw7l1WdqTi3w8bDzr_EnQzeGEpPnQzekeBEEFLVkojg7jm6ypef1ec-BPNB4uRdbX8k2WsSoL216_RgxOl4z3ZjTkJ2HFckTnVtHqd7Q91sU5cT_eI76iG3PEndIorc5BYphZFtOiaTMuzfTAMbY6qg3CHGnyb-FEKF42P18C8XdIMqqZs/s856/P1107%20-%20git-add-commit-push.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="600" data-original-height="407" data-original-width="856" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcRck9fm6xNOgw7l1WdqTi3w8bDzr_EnQzeGEpPnQzekeBEEFLVkojg7jm6ypef1ec-BPNB4uRdbX8k2WsSoL216_RgxOl4z3ZjTkJ2HFckTnVtHqd7Q91sU5cT_eI76iG3PEndIorc5BYphZFtOiaTMuzfTAMbY6qg3CHGnyb-FEKF42P18C8XdIMqqZs/s600/P1107%20-%20git-add-commit-push.png"/&gt;&lt;/a&gt;&lt;/div&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjToCOwPrTDmAAvwC78fSD_7a5bW5wz-uczQB9iBGMC_cxcFh6s1MNRbLqXYhpEbNlUWxrhJjyg5Ypiz5rj6gEWdXjUciSIeByJV74_WN-wLU6TbPIcZLgSrdB-JQQAwqZ4qNJNHn22xf0PMOqyRkq5cHli63O-OadoM-iiMZFLv65Ls-D7zmF8rpEaPLSb/s72-c/P1107%20-%20git-init.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Microsoft.Data.SqlClient.SqlException: The certificate chain was issued by an authority that is not trusted</title><link>http://idreesdotnet.blogspot.com/2023/12/microsoftdatasqlclientsqlexception-certificate-not-trusted.html</link><category>ASP DotNet</category><category>ASP DotNet Core</category><category>C#</category><category>MS SQL Server</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sun, 31 Dec 2023 16:49:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-2213166657565498052</guid><description>
&lt;p&gt;
I faced this error while using the Entity Framework Core with .Net 6.0,
&lt;/p&gt;
 
&lt;pre class="brush: xml;"&gt;
Microsoft.Data.SqlClient.SqlException: 'A connection was successfully established 
with the server, but then an error occurred during the login process. 
(provider: SSL Provider, error: 0 - The certificate chain was issued by an authority
that is not trusted.)'
&lt;/pre&gt;

&lt;h3&gt;
  Breaking change in Microsoft.Data.SqlClient 4.0.0.
&lt;/h3&gt;
&lt;p&gt;
I found there is breaking change in &lt;a href="https://docs.microsoft.com/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace?view=sql-server-ver15#breaking-changes-in-40" target="_blank"&gt;
Microsoft.Data.SqlClient - 4.0.0
&lt;/a&gt;
.
&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre&gt;
Changed Encrypt connection string property to be true by default:
The default value of the Encrypt connection setting has been changed from false to true. 
With the growing use of cloud databases and the need to ensure those connections are secure, 
it's time for this backwards-compatibility-breaking change.

Ensure connections fail when encryption is required:
In scenarios where client encryption libraries were disabled or unavailable, 
it was possible for unencrypted connections to be made when Encrypt was set to true
or the server required encryption.
&lt;/pre&gt;
&lt;/blockquote&gt;


&lt;h3&gt;
Solution
&lt;/h3
&lt;p&gt;
The quick-fix is to add &lt;code&gt;Encrypt=False&lt;/code&gt; to your connection-strings.
&lt;/p&gt;
&lt;p&gt;
Alongwith &lt;code&gt;Encrypt=False&lt;/code&gt;, setting &lt;code&gt;Trusted_Connection=True&lt;/code&gt; would also help.
&lt;/p&gt;

&lt;p&gt;
Another workaround if you are using local computer is to set 
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
TrustServerCertificate=True
&lt;/pre&gt;

&lt;p&gt;
Please note that, setting &lt;code&gt;TrustServerCertificate=True&lt;/code&gt; is not a real fix. The more authentic part of the solution is installing a CA signed certificate.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.microsoft.com/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace?view=sql-server-ver15#breaking-changes-in-40" target="_blank"&gt;
Microsoft.Data.SqlClient - Breaking changes in 4.0
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Serialize with System.Text.Json.JsonSerializer</title><link>http://idreesdotnet.blogspot.com/2023/12/serialize-with-systemtextjsonjsonserial.html</link><category>C#</category><category>DotNet</category><category>Visual Studio</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 26 Dec 2023 13:45:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-7300649119861987566</guid><description>
&lt;p&gt;
The &lt;code&gt;System.Text.Json&lt;/code&gt; namespace provides functionality for serializing to and deserializing from JavaScript Object Notation (JSON). 
When serializing C# objects to json, by default all public properties are serialized. 
&lt;/p&gt;

&lt;p&gt;
Lets say we have this &lt;code&gt;User&lt;/code&gt; class object we want to serialize:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
 class User
 {
     public int Id { get; set; }
     public string Name { get; set; }
     public string? Email { get; set; }
     public string Password { get; set; }
 }

var obj = new User
 {
     Id = 1,
     Name = "Idrees",
     Email = null,
     Password = "123"
 };
&lt;/pre&gt;

&lt;p&gt;
If we serialize this object:
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;
string txtJson = Json.JsonSerializer.Serialize(obj);
&lt;/pre&gt;

&lt;p&gt;
We will get the this json:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
{"Id":1,"Name":"Idrees","Email":null,"Password":"123"}
&lt;/pre&gt;

&lt;p&gt;
If we want to skip the &lt;code&gt;Password&lt;/code&gt; property, we can use the attribute &lt;code&gt;[JsonIgnore]&lt;/code&gt; on that property.
&lt;/p&gt;
&lt;p&gt;
After this change the &lt;code&gt;User&lt;/code&gt; class will look like this:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
 class User
 {
     public int Id { get; set; }
     public string Name { get; set; }
     public string Email { get; set; }
     [JsonIgnore]
     public string Password { get; set; }
 }
&lt;/pre&gt;

&lt;p&gt;
Serializing now will give you this result:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
{"Id":1,"Name":"Idrees","Email":null}
&lt;/pre&gt;

&lt;p&gt;
Notice that the &lt;code&gt;Password&lt;/code&gt; property is no longer serialized.
&lt;/p&gt;

&lt;p&gt;
You can also specify the condition for exclusion by setting the &lt;code&gt;[JsonIgnore]&lt;/code&gt; attribute's &lt;code&gt;Condition&lt;/code&gt; property. 
&lt;/p&gt;
&lt;p&gt;
In above example, we have set the null value for &lt;code&gt;Email&lt;/code&gt; property and it is showing &lt;code&gt;null&lt;/code&gt; in serialized json text. 
&lt;/p&gt;
&lt;p&gt;
To exclude that property we can specify the condition to ignore when it has &lt;code&gt;null&lt;/code&gt; value.
After this change the &lt;code&gt;User&lt;/code&gt; class will become like this:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
 class User
 {
     public int Id { get; set; }
     public string Name { get; set; }
     [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
     public string? Email { get; set; }
     [JsonIgnore]
     public string Password { get; set; }
 }
&lt;/pre&gt;
 
&lt;p&gt;
The serialization will remove the &lt;code&gt;Email&lt;/code&gt; property and generate this json.
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
{"Id":1,"Name":"Idrees"}
&lt;/pre&gt;


&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/ignore-properties" target="_blank"&gt;
How to ignore properties with System.Text.Json
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Repeat a String in C#</title><link>http://idreesdotnet.blogspot.com/2023/12/repeat-string-in-c.html</link><category>C#</category><category>DotNet</category><category>Visual Studio</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 26 Dec 2023 13:11:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-4412018313881073519</guid><description>
&lt;p&gt;
C# do not have built-in function, as of C# 12.0, to repeat a string for x number of times. 
&lt;/p&gt;

&lt;p&gt;
Lets say we have a string variable:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
	string text = "-"; //the string we need to repeat
	int n = 5; // number-of-times to repeat
&lt;/pre&gt;

&lt;p&gt;
Here are some ways you can use to repeat a string value:
&lt;/p&gt;

&lt;h3&gt;
Using Enumerable.Repeat and string.Concat:
&lt;/h3&gt;
&lt;pre class="brush: csharp;"&gt;
	string result1 = string.Concat(Enumerable.Repeat(text, n));
&lt;/pre&gt;


&lt;h3&gt;
Using StringBuilder:
&lt;/h3&gt;
&lt;pre class="brush: csharp;"&gt;
	string result2 = new StringBuilder().Insert(0, text, n).ToString();
&lt;/pre&gt;

&lt;h3&gt;
Using Enumerable.Range, Select with string.Concat
&lt;/h3&gt;
&lt;pre class="brush: csharp;"&gt;
	var repeatedStrings = Enumerable.Range(0, n).Select(i =&gt; text);
	string result3 = string.Concat(repeatedStrings);
&lt;/pre&gt;

&lt;h3&gt;
Using String() constructor
&lt;/h3&gt;
&lt;p&gt;
If the required string is single character, you can also use String constructor.
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;
	string result4 = new String('-', n);
&lt;/pre&gt;
	</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>C# Caller Argument Expression Attribute</title><link>http://idreesdotnet.blogspot.com/2023/11/c-caller-argument-expression-attribute.html</link><category>C#</category><category>DotNet</category><category>Visual Studio</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 28 Nov 2023 23:50:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-3627386992044367492</guid><description>

&lt;p&gt;
The &lt;code&gt;System.Runtime.CompilerServices.CallerArgumentExpressionAttribute&lt;/code&gt; enables you to receive the expression passed as an argument. 
It captures the expression passed for another parameter as a string.
&lt;/p&gt;

&lt;p&gt;
This would be helpful specially in diagnostic libraries which need to provide more details about the expressions passed to arguments. 
By providing the expression that triggered the diagnostic, in addition to the parameter name, developers have more details about the condition that triggered the diagnostic.
&lt;/p&gt;

&lt;p&gt;
Lets say we have this method to log the method name.
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
public static void LogMethodName(string name, 
                 [CallerArgumentExpression("name")] string? message = null)
{
   if (string.IsNullOrEmpty(name))
   {
      //we are printing the 'message' which represents the actual expression 
      //being passed for parameter 'name'
      throw new ArgumentException($"Argument validation: &amp;lt;{message}&amp;gt;", name);
   }

   Console.WriteLine($"Method {name} is called.");
}
&lt;/pre&gt;

&lt;p&gt;
Here we are calling above method:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
public static void RegisterUser()
{
    LogMethodName(nameof(RegisterUser));
}
&lt;/pre&gt;

&lt;p&gt;
In &lt;code&gt;RegisterUser&lt;/code&gt; method, we are calling &lt;code&gt;LogMethodName&lt;/code&gt; with the value as &lt;code&gt;name&lt;/code&gt; of &lt;code&gt;RegisterUser&lt;/code&gt;. 
The expression used for &lt;code&gt;name&lt;/code&gt; parameter, is injected by the compiler into the &lt;code&gt;message&lt;/code&gt; argument.
&lt;/p&gt;
&lt;p&gt;
In this example, the expression passed for the &lt;code&gt;name&lt;/code&gt; parameter is &lt;code&gt;nameof(RegisterUser)&lt;/code&gt;, so the value of &lt;code&gt;message&lt;/code&gt; parameter in &lt;code&gt;LogMethodName&lt;/code&gt; is &lt;code&gt;"nameof(RegisterUser)"&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/attributes/caller-information#argument-expressions" target="_blank"&gt;
Caller Argument Expression Attribute
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>C# documentation comments - para and cref</title><link>http://idreesdotnet.blogspot.com/2023/11/c-documentation-comments-para-and-cref.html</link><category>C#</category><category>DotNet</category><category>Visual Studio</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Tue, 28 Nov 2023 23:04:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8824764139745999465</guid><description>&lt;p&gt;
C# documentation comments use XML elements to define the structure of the output documentation. It helps to write the information about code and makes it more readable and understandable.
&lt;/p&gt;

&lt;h3&gt;
&amp;lt;para&amp;gt; tag
&lt;/h3&gt;

&lt;p&gt;
The &lt;code&gt;&amp;lt;para&amp;gt;&lt;/code&gt; tag can be used inside a tag, such as &lt;code&gt;&amp;lt;summary&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;remarks&amp;gt;&lt;/code&gt;, or &lt;code&gt;&amp;lt;returns&amp;gt;&lt;/code&gt;. 
It allows you to add structure to the text. 
&lt;/p&gt;
&lt;p&gt;
Here the &lt;code&gt;&amp;lt;para&amp;gt;&lt;/code&gt; is used to add another line (paragraph) in the summary section.
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
/// &amp;lt;summary&amp;gt;
/// This property will keep the type of project.
///     &amp;lt;para&amp;gt;
///         The Type of project defined in the document.
///     &amp;lt;/para&amp;gt;
/// &amp;lt;/summary&amp;gt;
public string ProjectType { get; set; }
&lt;/pre&gt;

&lt;p&gt;
It will display this information on mouse hover like this:
&lt;/p&gt;
&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb0hr5iw91o-1b8rvNK2khapAy6TCgQhhw0SVc4x3gzfJ0ksZzDKCtMvG1oUCapzPRkOijMs-qF0MtJyYr3rNwlkSJmEHI8Ck0bEniOzBB5LJ6WqP8DK3ok3ifornbo8IXV0Bra6363-QH5ef9w-waSYibUYzXuOoSdti2drioHnMdqa3mhy8_WQ8jK1LL/s334/P1106-para-tag.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="400" data-original-height="95" data-original-width="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb0hr5iw91o-1b8rvNK2khapAy6TCgQhhw0SVc4x3gzfJ0ksZzDKCtMvG1oUCapzPRkOijMs-qF0MtJyYr3rNwlkSJmEHI8Ck0bEniOzBB5LJ6WqP8DK3ok3ifornbo8IXV0Bra6363-QH5ef9w-waSYibUYzXuOoSdti2drioHnMdqa3mhy8_WQ8jK1LL/s400/P1106-para-tag.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;h3&gt;
cref attribute
&lt;/h3&gt;

&lt;p&gt;
The &lt;code&gt;cref&lt;/code&gt; attribute in an XML documentation tag means "code reference." It specifies that the inner text of the tag is a code element, such as a type, method, or property. 
&lt;/p&gt;

&lt;p&gt;
Here the &lt;code&gt;cref&lt;/code&gt; attribute is referencing another class which contains constant string values.
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
/// &amp;lt;summary&amp;gt;
///     &amp;lt;para&amp;gt;
///         Use &amp;lt;see cref="MyNamespace.ProjectStatus"/&amp;gt; class.
///     &amp;lt;/para&amp;gt;
/// &amp;lt;/summary&amp;gt;
public string Status { get; set; }
&lt;/pre&gt;

&lt;p&gt;
On mouse hover it will display like this:
&lt;/p&gt;

&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjTjkaGFH48CKK1PZNh6GWDw-_AuF2aGmDNCxQ9Az9Sbo40YLkRWyeK84XksTYnhGgk5aNoZvHe2NEZRMpKmZbNaEj_uyV6dy4qkPYiNLcFaID_pvzmLGdP9prlqDfpPdclmtPVRN_t8P6cqYRZUiP69yRU6p4GHI_d5Fp9Qi4Q94pbuZYHbLxV9gLyWwB/s292/P1106-cref-attribute.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="400" data-original-height="74" data-original-width="292" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjTjkaGFH48CKK1PZNh6GWDw-_AuF2aGmDNCxQ9Az9Sbo40YLkRWyeK84XksTYnhGgk5aNoZvHe2NEZRMpKmZbNaEj_uyV6dy4qkPYiNLcFaID_pvzmLGdP9prlqDfpPdclmtPVRN_t8P6cqYRZUiP69yRU6p4GHI_d5Fp9Qi4Q94pbuZYHbLxV9gLyWwB/s400/P1106-cref-attribute.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
Note that the &lt;code&gt;ProjectStatus&lt;/code&gt; will appear as link, and will take you to the definition of class when clicked.
&lt;/p&gt;


&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/xmldoc/recommended-tags" target="_blank"&gt;
XML tags for C# documentation comments
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb0hr5iw91o-1b8rvNK2khapAy6TCgQhhw0SVc4x3gzfJ0ksZzDKCtMvG1oUCapzPRkOijMs-qF0MtJyYr3rNwlkSJmEHI8Ck0bEniOzBB5LJ6WqP8DK3ok3ifornbo8IXV0Bra6363-QH5ef9w-waSYibUYzXuOoSdti2drioHnMdqa3mhy8_WQ8jK1LL/s72-c/P1106-para-tag.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Kendo UI Grid - Nested child grids</title><link>http://idreesdotnet.blogspot.com/2023/10/kendo-ui-grid-nested-child-grids.html</link><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sun, 29 Oct 2023 23:27:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-7333569493454764754</guid><description>&lt;p&gt;
  To add hierarchy or nested child grids in Kendo UI Grid component, we can use the &lt;code&gt;detailInit&lt;/code&gt; event for the parent grid and initialize the next level of hierarchy.
&lt;/p&gt;
  
&lt;p&gt;
  Lets say we have the following function which will return dummy data based on &lt;code&gt;ParentAccountID&lt;/code&gt;.
&lt;/p&gt;
  
&lt;pre class="brush: xml;"&gt;
private getGridData(parentAccountID: string) {
	var data = [
		{
			"RowLabel": "Initial Balance",
			"AccountID": "1",
			"AccountNo": 1,
			"AccountName": "Account1",
			"AccountTitle": "1 - Account1",
			"ParentAccountID": null,
		},
		{
			"RowLabel": "Initial Balance",
			"AccountID": "2",
			"AccountNo": 2,
			"AccountName": "Account2",
			"AccountTitle": "2 - Account2",
			"ParentAccountID": null,
		},
		{
			"RowLabel": "Initial Balance",
			"AccountID": "3",
			"AccountNo": 3,
			"AccountName": "Account3",
			"AccountTitle": "3 - Account3",
			"ParentAccountID": "1",
		},
		{
			"RowLabel": "Initial Balance",
			"AccountID": "4",
			"AccountNo": 4,
			"AccountName": "Account4",
			"AccountTitle": "4 - Account4",
			"ParentAccountID": "2",
		}
	];

	var tempData = data;
	tempData = tempData.filter((obj) =&gt; {
		return obj.ParentAccountID === parentAccountID;
	});
		
	return tempData;
}
&lt;/pre&gt;

&lt;p&gt;
  Here is how we can define the grid configuration to call above function to get data for &lt;code&gt;ParentAccountID&lt;/code&gt;.
&lt;/p&gt;
  
&lt;pre class="brush: xml;"&gt;
private createDataInquiryGrid3() {

	var tempData = this.getGridData(null);//Pass null as ParentAccountID for 1st level data.
	
	var element = $("#grid").kendoGrid({
		dataSource: {
			data: tempData,
		},
		height: 600,
		sortable: false,
		pageable: false,
		detailInit: this.detailInit,//this event will define child grid configuration
		dataBound: function () {
			this.expandRow(this.tbody.find("tr.k-master-row").first());
		},
		columns: [
			{ field: "AccountTitle", title: " ", aggregates: ["count"] },
			{ field: "AccountNo", title: "AccountNo" },
			{ field: "AccountName", title: "AccountName" },
		]
	});
}

private detailInit(e) {
	//e.data contains the current row's data-object.
	var getDataFunction = window["getGridData"];
	var tempData = getDataFunction(e.data.AccountID);
	
	$("&amp;lt;div/&amp;gt;").appendTo(e.detailCell).kendoGrid({
		dataSource: {
			data: tempData,
		},
		scrollable: false,
		sortable: false,
		pageable: false,
		columns: [
			{ field: "AccountTitle", title: " ", aggregates: ["count"] },
			{ field: "AccountNo", title: "AccountNo" },
			{ field: "AccountName", title: "AccountName" },
		]
	});
}
&lt;/pre&gt;

&lt;p&gt;
  It will display the grids like this:
&lt;/p&gt;
    

&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSYtR5YS6Y6pcuSUpYOepsaox31IBwYEnb_ZJV9giPiIitS2dfM440YOylgmRYGcMMIRLzc2Mkk7uTe3_QfBPoTNseI44jBZCo9QHjcRaPrmpOrzZ2LrgYgjbsEF-HK_EJF3Od0oGANsO8Ok6wyD4srzvb7ed_tmVilvRFaEA6txZcx1YZ6QT6yAPSjdM/s1442/P1105-KendoUIGrid-Nested1.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="600" data-original-height="411" data-original-width="1442" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSYtR5YS6Y6pcuSUpYOepsaox31IBwYEnb_ZJV9giPiIitS2dfM440YOylgmRYGcMMIRLzc2Mkk7uTe3_QfBPoTNseI44jBZCo9QHjcRaPrmpOrzZ2LrgYgjbsEF-HK_EJF3Od0oGANsO8Ok6wyD4srzvb7ed_tmVilvRFaEA6txZcx1YZ6QT6yAPSjdM/s600/P1105-KendoUIGrid-Nested1.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
  With &lt;code&gt;detailInit&lt;/code&gt; event you can add multiple level of nested grids using the same event in nested grids.
&lt;/p&gt;
  

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.telerik.com/kendo-ui/knowledge-base/grid-add-nested-child-grids" target="_blank"&gt;
Kendo UI Grid - Nested Child Grids
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/10/kendo-ui-grid-column-template.html" target="_blank"&gt;
Kendo UI Grid - Column Template
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSYtR5YS6Y6pcuSUpYOepsaox31IBwYEnb_ZJV9giPiIitS2dfM440YOylgmRYGcMMIRLzc2Mkk7uTe3_QfBPoTNseI44jBZCo9QHjcRaPrmpOrzZ2LrgYgjbsEF-HK_EJF3Od0oGANsO8Ok6wyD4srzvb7ed_tmVilvRFaEA6txZcx1YZ6QT6yAPSjdM/s72-c/P1105-KendoUIGrid-Nested1.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Kendo UI Grid - Column Template</title><link>http://idreesdotnet.blogspot.com/2023/10/kendo-ui-grid-column-template.html</link><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sat, 28 Oct 2023 22:39:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8739756990726980852</guid><description>&lt;p&gt;
Kendo UI grid will display the column data in table format. If we need to customize the display value for specific column we can use the &lt;code&gt;template&lt;/code&gt; function.
It allows us to define the &lt;code&gt;template&lt;/code&gt; which renders the actual content for that column.
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;columns&lt;/code&gt; array can be defined like this:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
columns: [
    { field: "AccountTitle", title: "AccountTitle"},
    { field: "TransactionType", title: "Type" },
    { field: "DatePosting", title: "Date", format: "{0:dd/MM/yyyy}" },
	{
		field: "Status",
		template: function (dataRow) {
			var linkHtml = "";
			if (dataRow.StatusNo == '1') {
				linkHtml = "&amp;lt;span style='color:green;'&amp;gt;Active&amp;lt;/span&amp;gt;";
			}
			else {
				linkHtml = "&amp;lt;span style='color:red;'&amp;gt;Deactive&amp;lt;/span&amp;lt;";
			}
			return linkHtml;
		},
		title: "Status"
	},
]
&lt;/pre&gt;

&lt;p&gt;
Note that &lt;code&gt;Status&lt;/code&gt; column, we have defined a &lt;code&gt;template&lt;/code&gt; function, which will accept the &lt;code&gt;dataRow&lt;/code&gt; as parameter and return the final html as string, which the Kendo Grid will display as cell's content.
&lt;/p&gt;


&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.template" target="_blank"&gt;
Kendo UI Grid - Column Template
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/10/kendo-ui-grid-nested-child-grids.html" target="_blank"&gt;
Kendo UI Grid - Nested child grids
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></item><item><title>Enable Tag Helper using @tagHelperPrefix</title><link>http://idreesdotnet.blogspot.com/2023/09/enable-tag-helper-using-taghelperprefix.html</link><category>ASP DotNet</category><category>ASP DotNet Core</category><category>ASP DotNet MVC</category><category>C#</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sat, 30 Sep 2023 18:52:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-3513549513712409828</guid><description>
&lt;p&gt;
The &lt;code&gt;@tagHelperPrefix&lt;/code&gt; directive allows you to specify a tag prefix string to enable Tag Helper support and to make Tag Helper usage explicit.
&lt;/p&gt;
&lt;p&gt;
For example, you could add the following markup to the &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
@tagHelperPrefix cst:
&lt;/pre&gt;

&lt;p&gt;
This allows you to enable Tag Helper support by using this prefix (&lt;code&gt;cst&lt;/code&gt;). Only those elements using the prefix &lt;code&gt;cst&lt;/code&gt;, support the Tag Helpers (Tag Helper-enabled elements have a distinctive font/color).
&lt;/p&gt;

&lt;p&gt;
In the code image below, the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; element have the Tag Helper prefix (&lt;code&gt;cst&lt;/code&gt;), so the Tag Helper is enabled for this element.
While the &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; element doesn't have Tag Helper prefix (&lt;code&gt;cst&lt;/code&gt;), so Tag Helper is not enabled for this element, this is just a regular HTML element.
&lt;/p&gt;

&lt;div class="separator" style="clear: both;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ-HhD3Y-dUyPbXCKUCMnKamxTHK1AwAh_53hfweh9jteZ1Di777PslwA45GHnVS-HdB3OO2ohcZsYl8hKqQN6bWmCy65VnjPqK3Ax5BefrNxzpPYFr_tXW0A45ct7Dn-TxZ-quNfuN3guoldqdM_VQGbjKluGQ8_eF6BGqEPM-wHSy4zXvS3XKcXCUklX/s469/P1104-DotNetCore-TagHelperPrefix.png" style="display: block; padding: 1em 0; text-align: center; "&gt;&lt;img alt="" border="0" width="400" data-original-height="108" data-original-width="469" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ-HhD3Y-dUyPbXCKUCMnKamxTHK1AwAh_53hfweh9jteZ1Di777PslwA45GHnVS-HdB3OO2ohcZsYl8hKqQN6bWmCy65VnjPqK3Ax5BefrNxzpPYFr_tXW0A45ct7Dn-TxZ-quNfuN3guoldqdM_VQGbjKluGQ8_eF6BGqEPM-wHSy4zXvS3XKcXCUklX/s400/P1104-DotNetCore-TagHelperPrefix.png"/&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;
The same hierarchy rules that apply to &lt;code&gt;@addTagHelper&lt;/code&gt; also apply to &lt;code&gt;@tagHelperPrefix&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" target="_blank"&gt;
Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/custom-tag-helpers-in-aspnet-core.html" target="_blank"&gt;
Custom Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/remove-tag-helpers-with-removetaghelper.html" target="_blank"&gt;
Remove Tag Helpers with @removeTagHelper
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/tag-helper-scope-with-viewimports-file.html" target="_blank"&gt;
Tag Helper scope with _ViewImports file
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQ-HhD3Y-dUyPbXCKUCMnKamxTHK1AwAh_53hfweh9jteZ1Di777PslwA45GHnVS-HdB3OO2ohcZsYl8hKqQN6bWmCy65VnjPqK3Ax5BefrNxzpPYFr_tXW0A45ct7Dn-TxZ-quNfuN3guoldqdM_VQGbjKluGQ8_eF6BGqEPM-wHSy4zXvS3XKcXCUklX/s72-c/P1104-DotNetCore-TagHelperPrefix.png" width="72"/><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Tag Helper scope with _ViewImports file</title><link>http://idreesdotnet.blogspot.com/2023/09/tag-helper-scope-with-viewimports-file.html</link><category>ASP DotNet</category><category>ASP DotNet Core</category><category>ASP DotNet MVC</category><category>C#</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sat, 30 Sep 2023 18:29:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-2296287337719715989</guid><description>
&lt;ul&gt;
&lt;li&gt;
The &lt;code&gt;_ViewImports.cshtml&lt;/code&gt; can be added to any view folder, and the view engine applies the directives from both that file and the &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file. 
&lt;/li&gt;
&lt;li&gt;
The &lt;code&gt;_ViewImports.cshtml&lt;/code&gt; file is additive, If you add an empty &lt;code&gt;Views/Home/_ViewImports.cshtml&lt;/code&gt; file for the &lt;code&gt;Home&lt;/code&gt; views, there would be no change because it will import all tag helpers from &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file. 
&lt;/li&gt;
&lt;li&gt;
If you add new tag helpers in &lt;code&gt;Views/Home/_ViewImports.cshtml&lt;/code&gt; file for the &lt;code&gt;Home&lt;/code&gt; views, it will import all tag helpers from &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file, also it will import all tag helpers from &lt;code&gt;Views/Home/_ViewImports.cshtml&lt;/code&gt; file.
&lt;/li&gt;
&lt;li&gt;
Any new &lt;code&gt;@addTagHelper&lt;/code&gt; directives you add to the &lt;code&gt;Views/Home/_ViewImports.cshtml&lt;/code&gt; file (that are not in the default &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file) would expose those Tag Helpers to views only in the &lt;code&gt;Home&lt;/code&gt; folder.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" target="_blank"&gt;
Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/custom-tag-helpers-in-aspnet-core.html" target="_blank"&gt;
Custom Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/remove-tag-helpers-with-removetaghelper.html" target="_blank"&gt;
Remove Tag Helpers with @removeTagHelper
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/enable-tag-helper-using-taghelperprefix.html" target="_blank"&gt;
Enable Tag Helper using @tagHelperPrefix
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Remove Tag Helpers with @removeTagHelper</title><link>http://idreesdotnet.blogspot.com/2023/08/remove-tag-helpers-with-removetaghelper.html</link><category>ASP DotNet</category><category>ASP DotNet Core</category><category>ASP DotNet MVC</category><category>C#</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Mon, 28 Aug 2023 23:38:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-7102005677746766236</guid><description>&lt;h3&gt;
Remove Tag Helpers with @removeTagHelper
&lt;/h3&gt;

&lt;p&gt;
The &lt;code&gt;@removeTagHelper&lt;/code&gt; removes a Tag Helper that was previously added by &lt;code&gt;@addTagHelper&lt;/code&gt;. 
&lt;/p&gt;

&lt;p&gt;
It has the same two parameters as &lt;code&gt;@addTagHelper&lt;/code&gt;:
&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;
@removeTagHelper *, MyApplicationTagHelpers
&lt;/pre&gt;

&lt;p&gt;
For example, when you want to restrict a specific Tag Helper on a particular view, you can apply the &lt;code&gt;@removeTagHelper&lt;/code&gt; to remove the specified Tag Helper.
&lt;/p&gt;
&lt;p&gt;
Using &lt;code&gt;@removeTagHelper&lt;/code&gt; in a child folder's &lt;code&gt;_ViewImports.cshtml&lt;/code&gt; file (e.g. Views/&lt;code&gt;Folder&lt;/code&gt;/_ViewImports.cshtml), it removes the specified Tag Helper from all of the views in that &lt;code&gt;Folder&lt;/code&gt;.
&lt;/p&gt;

&lt;h3&gt;
Opting out of individual Tags
&lt;/h3&gt;

&lt;p&gt;
Instead of removing the Tag Helper from a View, you can also disable a Tag Helper at the element level with the Tag Helper opt-out character (&lt;code&gt;"!"&lt;/code&gt;). 
&lt;/p&gt;
&lt;p&gt;
For example, we can disable the Email validation in the &amp;lt;span&amp;gt; with the Tag Helper opt-out character:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;!span asp-validation-for="Email" class="text-danger"&amp;gt;&amp;lt;/!span&amp;gt;
&lt;/pre&gt;
&lt;p&gt;
In this case, the Tag Helper will be disabled on a single element (&lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; in this case), rather than all elements in a View.
&lt;/p&gt;
&lt;p&gt;
The Tag Helper opt-out character must be applied to the both opening and closing tags.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" target="_blank"&gt;
Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/custom-tag-helpers-in-aspnet-core.html" target="_blank"&gt;
Custom Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/tag-helper-scope-with-viewimports-file.html" target="_blank"&gt;
Tag Helper scope with _ViewImports file
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/enable-tag-helper-using-taghelperprefix.html" target="_blank"&gt;
Enable Tag Helper using @tagHelperPrefix
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Custom Tag Helpers in ASP.NET Core</title><link>http://idreesdotnet.blogspot.com/2023/08/custom-tag-helpers-in-aspnet-core.html</link><category>ASP DotNet</category><category>ASP DotNet Core</category><category>ASP DotNet MVC</category><category>C#</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Mon, 28 Aug 2023 21:37:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-3927987794290177493</guid><description>
&lt;p&gt;
Tag Helper allows you to add or modify HTML elements from server-side code. In Razor markup, the Tag Helper looks like standard HTML elements. It provides more productive
syntax than manually writing the C# Razor markup.
&lt;/p&gt;

&lt;blockquote&gt;
Tag Helpers enable server-side code to participate in creating and rendering HTML elements in Razor files. 
&lt;/blockquote&gt;
&lt;p&gt;
&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" target="_blank"&gt;
&lt;code&gt;(Microsoft Docs - Tag Helpers in ASP.NET Core)&lt;/code&gt;
&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
To create a custom Tag Helper, you need to inherit from built-in &lt;code&gt;TagHelper&lt;/code&gt; class. For example we have this Tag Helper,
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
public class StringTagHelper : TagHelper
{
   public override void Process(TagHelperContext context, TagHelperOutput output)
   {
      output.TagName = "span";
      output.TagMode = TagMode.StartTagAndEndTag;

      output.Attributes.Add("data-entity", "customer");

      base.Process(context, output);
   }
}
&lt;/pre&gt;

&lt;p&gt;
This Tag Helper will output the &lt;code&gt;span&lt;/code&gt; element and add a custom attribute &lt;code&gt;data-entity&lt;/code&gt; with value &lt;code&gt;customer&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
In the Razor markup, we can use this Tag Helper as:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
&amp;lt;string field="CustomerID"&amp;gt;&amp;lt;/string&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Ofcourse we can add any extra/custom attributes to html tags, these will not interrupt with Tag Helpers.
&lt;/p&gt;

&lt;p&gt;
The browser will render the final output as:
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
&amp;lt;span field="CustomerID" data-entity="customer"&amp;gt;&amp;lt;/span&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
To use the Tag Helpers in the views, you need to set its scope, usually we define the scope in &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file.
&lt;/p&gt;

&lt;p&gt;
Tag Helpers scope is controlled by a combination of &lt;code&gt;@addTagHelper&lt;/code&gt;, &lt;code&gt;@removeTagHelper&lt;/code&gt;, and the &lt;code&gt;"!"&lt;/code&gt; opt-out character.
&lt;/p&gt;

&lt;p&gt;
To make the required TagHelper avialable for one or more views we use &lt;code&gt;@addTagHelper&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
If you create a new ASP.NET Core web app named &lt;code&gt;MyApplicationTagHelpers&lt;/code&gt;, the following &lt;code&gt;Views/_ViewImports.cshtml&lt;/code&gt; file will be added to your project:
&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, MyApplicationTagHelpers
&lt;/pre&gt;

&lt;p&gt;
Some points for above code:
&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;
	The code above uses the wildcard syntax (&lt;code&gt;"*"&lt;/code&gt;) to specify that all Tag Helpers in the specified assembly (&lt;code&gt;Microsoft.AspNetCore.Mvc.TagHelpers&lt;/code&gt;) will be available to every view file in the Views directory or subdirectory. 
	&lt;/li&gt;
	&lt;li&gt;
	The first parameter after @addTagHelper specifies the Tag Helpers to load (&lt;code&gt;"*"&lt;/code&gt; is used to load all Tag Helpers)
	&lt;/li&gt;
	&lt;li&gt;
	The second parameter &lt;code&gt;"Microsoft.AspNetCore.Mvc.TagHelpers"&lt;/code&gt; specifies the source assembly from which we want to load the Tag Helpers. It can be current project's assemly or any reference to external library.
	&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro" target="_blank"&gt;
Tag Helpers in ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/08/remove-tag-helpers-with-removetaghelper.html" target="_blank"&gt;
Remove Tag Helpers with @removeTagHelper
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/tag-helper-scope-with-viewimports-file.html" target="_blank"&gt;
Tag Helper scope with _ViewImports file
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/09/enable-tag-helper-using-taghelperprefix.html" target="_blank"&gt;
Enable Tag Helper using @tagHelperPrefix
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>MSB3037 - NSwag- openapi2csclient exited with code -1</title><link>http://idreesdotnet.blogspot.com/2023/07/msb3037-nswag-openapi2csclient-exited.html</link><category>ASP DotNet Core</category><category>Swagger</category><category>Visual Studio</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Mon, 24 Jul 2023 11:28:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-5287225651135423449</guid><description>
&lt;p&gt;
I was working with Visual Studio 2022 (Version 17.6.5). The project has consumed the nuget package for &lt;code&gt;NSwag.ApiDescription.Client (version 13.19.0)&lt;/code&gt;. It was working fine.
&lt;/p&gt;

&lt;p&gt;
When I moved the project to another machine, it starts generating this error on &lt;code&gt;Rebuild&lt;/code&gt;:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
The command ""C:\Users\x\source\repos\G21-V5-Web\packages_rep\nswag.msbuild\13.0.5\build\
../tools/Win/NSwag.exe" 
openapi2csclient /className:ServiceClient /namespace:MyService 
/input:C:\Users\x\source\repos\G21-V5-Web\swagger.json /output:obj\swaggerClient.cs " 
exited with code -1.
&lt;/pre&gt;

&lt;p&gt;
I found out the root cause in my case was the whitespaces in the path to the project.
&lt;/p&gt;

&lt;p&gt;
We need to fix in the file:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
C:\Users\x\source\repos\G21-V5-Web\packages_rep\nswag.apidescription.client\13.0.5
\build\NSwag.ApiDescription.Client.targets
&lt;/pre&gt;

&lt;p&gt;
You will find line # 21 similar to this:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
    &amp;lt;Command&amp;gt;%(Command) /input:%(FullPath) /output:%(OutputPath) %(Options)&amp;lt;/Command&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
To make swagger work with whitespaces, change this line by adding double quotes around the &lt;code&gt;path&lt;/code&gt;:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
    &amp;lt;Command&amp;gt;%(Command) /input:"%(FullPath)" /output:"%(OutputPath)" %(Options)&amp;lt;/Command&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
My project works fine after this fix.
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Compile TypeScript code with ASP.NET WebSite Project</title><link>http://idreesdotnet.blogspot.com/2023/07/compile-typescript-code-with-aspnet-website.html</link><category>ASP DotNet</category><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Mon, 24 Jul 2023 10:48:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8216676434498661214</guid><description>
&lt;p&gt;
In previous posts we have seen how to configure TypeScript code with 
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-core.html" target="_blank"&gt;
&lt;code&gt;ASP.NET Core Project&lt;/code&gt; 
&lt;/a&gt;
and 
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-webapplication.html" target="_blank"&gt;
&lt;code&gt;Web Application Project&lt;/code&gt; 
&lt;/a&gt;
.
In this post we will configure the TypeScript in an &lt;code&gt;ASP.NET WebSite Project&lt;/code&gt; (.Net Framework).
&lt;/p&gt;




&lt;p&gt;
Suppose we already have an ASP.Net WebSite Project.
&lt;/p&gt;

&lt;p&gt;
Inside &lt;code&gt;Scripts&lt;/code&gt; folder, Create a new TypeScript file, say &lt;code&gt;app.ts&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Add the folowing code:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
sayHello(name: string) {
	console.log("Hello " + name);
}
&lt;/pre&gt;

&lt;p&gt;
As we changed some configurations for TypeScript compiler in the last post, we will do the same here. Select &lt;code&gt;Add New Item&lt;/code&gt;, and choose &lt;code&gt;TypeScript Configuration File&lt;/code&gt; and use the default name of &lt;code&gt;tsconfig.json&lt;/code&gt;. Replace the content in &lt;code&gt;tsconfig.json&lt;/code&gt; file with following.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": false,
    "target": "ES2015",
    "allowJs": false,
    "inlineSourceMap": true,
    "sourceRoot": "./",
    "outDir": "Scripts",
    "inlineSources": true,
    "lib": [ "es2015", "es2016", "dom", "es2018.promise" ]
  },
  "exclude": [
    "./Scripts/JS"
  ],
  "include": [
    "Scripts/*.ts"
  ],
  "compileOnSave": true
}
&lt;/pre&gt;

&lt;p&gt;
The &lt;code&gt;include&lt;/code&gt; section above instructs the compiler to compile all typescritps files inside &lt;code&gt;Scripts&lt;/code&gt; folder.
It will exlude the files for compilation which will be palced inside &lt;code&gt;Scripts/JS&lt;/code&gt; folder as mentioned in &lt;code&gt;exclude&lt;/code&gt; section above. 
It also tells the compiler to copy the output js files in &lt;code&gt;Scripts&lt;/code&gt; folder (mentioned by &lt;code&gt;outDir&lt;/code&gt; key). We need to use the same path when referencing the js file in HTML.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;script src="Scripts/app.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Save the changes, and reload the project. 
&lt;/p&gt;

&lt;p&gt;
Now we have all setup with TypeScript, we can write TypeScript code and it should work.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-core.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-webapplication.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET Web Applicaton Project
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Compile TypeScript code with ASP.NET Web Applicaton Project</title><link>http://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-webapplication.html</link><category>ASP DotNet</category><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Thu, 22 Jun 2023 11:45:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-6196490296497059816</guid><description>
&lt;p&gt;
In the &lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-core.html" target="_blank"&gt;
&lt;code&gt;last post&lt;/code&gt;
&lt;/a&gt; we have seen how to configure TypeScript code with &lt;code&gt;ASP.NET Core Project&lt;/code&gt;.
In this post we will configure the TypeScript in an &lt;code&gt;ASP.NET Web Applicaton Project&lt;/code&gt; (.Net Framework).
&lt;/p&gt;

&lt;p&gt;
Suppose we already have an ASP.Net Web Application Project.
&lt;/p&gt;

&lt;p&gt;
Inside &lt;code&gt;Scripts&lt;/code&gt; folder, Create a new TypeScript file, say &lt;code&gt;app.ts&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Add the folowing code:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
sayHello(name: string) {
	console.log("Hello " + name);
}
&lt;/pre&gt;

&lt;p&gt;
As we changed some configurations for TypeScript compiler in the last post, we will do the same here. Select &lt;code&gt;Add New Item&lt;/code&gt;, and choose &lt;code&gt;TypeScript Configuration File&lt;/code&gt; and use the default name of &lt;code&gt;tsconfig.json&lt;/code&gt;. Replace the content in &lt;code&gt;tsconfig.json&lt;/code&gt; file with following.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
{
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": false,
    "target": "ES2015",
    "allowJs": false,
    "inlineSourceMap": true,
    "sourceRoot": "./",
    "outDir": "Scripts",
    "inlineSources": true,
    "lib": [ "es2015", "es2016", "dom", "es2018.promise" ]
  },
  "exclude": [
    "./Scripts/JS"
  ],
  "compileOnSave": true
}
&lt;/pre&gt;

&lt;p&gt;
It will exlude the files for compilation which will be palced inside &lt;code&gt;Scripts/JS&lt;/code&gt; folder as mentioned in &lt;code&gt;exclude&lt;/code&gt; section above. It also tells the compiler to copy the output js files in &lt;code&gt;Scripts&lt;/code&gt; folder (mentioned by &lt;code&gt;outDir&lt;/code&gt; key). We need to use the same path when referencing the js file in HTML.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;script src="Scripts/app.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Sometimes you might also need to manually add a TypeScript compiler task to your website project. 
Edit &lt;code&gt;[YourProjectName].csproj&lt;/code&gt; file, and add the following &lt;code&gt;&amp;lt;Target&amp;gt;&lt;/code&gt; element before the &lt;code&gt;&amp;lt;/Project&amp;gt;&lt;/code&gt; closing tag:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;Target Name="TypeScriptCompile" BeforeTargets="Build"&amp;gt;
  &amp;lt;Exec Command="tsc" /&amp;gt;
&amp;lt;/Target&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Save the changes, and reload the project. 
&lt;/p&gt;

&lt;p&gt;
Now we have all setup with TypeScript, we can write TypeScript code and it should work.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-core.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET Core
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/07/compile-typescript-code-with-aspnet-website.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET WebSite Project
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>Compile TypeScript code with ASP.NET Core</title><link>http://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-core.html</link><category>ASP DotNet Core</category><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Sun, 18 Jun 2023 14:46:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-3734912482874901528</guid><description>
&lt;p&gt;
In this post I will explain the steps we need to setup &lt;code&gt;TypeScript&lt;/code&gt; into an ASP.NET Core project.
&lt;/p&gt;

&lt;p&gt;
Lets suppose we already have an ASP.Net Core Project. 
&lt;/p&gt;

&lt;p&gt;
We need to install Nuget Package &lt;code&gt;Microsoft.TypeScript.MSBuild&lt;/code&gt; to build typescript code/files.
&lt;/p&gt;

&lt;p&gt;
Create a new file named &lt;code&gt;app.ts&lt;/code&gt;.
&lt;/p&gt;

&lt;p&gt;
Add the folowing code:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
sayHello(name: string) {
	console.log("Hello " + name);
}
&lt;/pre&gt;

&lt;p&gt;
We need to tell TypeScript by configuration settings to direct the behavior for compilation.
Select &lt;code&gt;Add New Item&lt;/code&gt;, and choose &lt;code&gt;TypeScript Configuration File&lt;/code&gt; and use the default name of &lt;code&gt;tsconfig.json&lt;/code&gt;.
Replace the content in &lt;code&gt;tsconfig.json&lt;/code&gt; file with following.
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
{
  "compileOnSave": true,
  "compilerOptions": {
    "noImplicitAny": false,
    "noEmitOnError": true,
    "removeComments": false,
    "sourceMap": true,
    "target": "es5",
    "outDir": "wwwroot/ts_build"
  },
  "exclude": [
    "./node_modules",
    "./wwwroot",
  ],
  "include": [
    "./TypeScripts"
  ]
}
&lt;/pre&gt;

&lt;p&gt;
It will include any typescript file for compilation which will be palced inside &lt;code&gt;TypeScripts&lt;/code&gt; folder as mentioned in &lt;code&gt;include&lt;/code&gt; section above.
It also tells the compiler to copy the output js files in &lt;code&gt;wwwroot/ts_build&lt;/code&gt; folder (mentioned by &lt;code&gt;outDir&lt;/code&gt; key). We need to use the same path when referencing the js file in HTML.
&lt;/p&gt;
  
&lt;pre class="brush: xml;"&gt;
&amp;lt;script src="~/ts_build/app.js"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
Now we have all setup with TypeScript, we can write TypeScript code and it should work.
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/visualstudio/javascript/tutorial-aspnet-with-typescript?view=vs-2022" target="_blank"&gt;
Create an ASP.NET Core app with TypeScript in Visual Studio
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/06/compile-typescript-with-aspnet-webapplication.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET Web Applicaton Project
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/07/compile-typescript-code-with-aspnet-website.html" target="_blank"&gt;
Compile TypeScript code with ASP.NET WebSite Project
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>TypeScript - Promise.race()</title><link>http://idreesdotnet.blogspot.com/2023/05/typescript-promiserace.html</link><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Thu, 4 May 2023 16:28:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-356750547786784667</guid><description>
&lt;p&gt;
The &lt;code&gt;Promise.race()&lt;/code&gt; static method takes an iterable of promises as input and returns a single Promise. 
This returned promise settles with the eventual state of the first promise that settles (either fulfilled or rejected). 
&lt;/p&gt;


&lt;p&gt;
It's useful when you want the first async task to complete, but do not care about its eventual state (i.e. it can either succeed or fail).
&lt;/p&gt;

&lt;p&gt;
Lets see an example:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
const promise1 = new Promise((resolve, reject) =&gt; {
  setTimeout(resolve, 300, 'promise1 value');
});

const promise2 = new Promise((resolve, reject) =&gt; {
  setTimeout(resolve, 100, 'promise2 value');
});

Promise.race([promise1, promise2]).then((value) =&gt; {
     // promise2 is faster, so the 'value' will be the result of promise2
   console.log(value);
});
&lt;/pre&gt;

&lt;p&gt;
Output will be :
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
promise2 value
&lt;/pre&gt;


&lt;p&gt;
In this example, both promises will get resolved, but since the &lt;code&gt;promise2&lt;/code&gt; is faster (with less waiting time), 
the &lt;code&gt;Promise.race()&lt;/code&gt; method will return &lt;code&gt;promise2&lt;/code&gt;, it is the first promise in the input list which get settled (rejected or resolved).
&lt;/p&gt;

&lt;p&gt;
If the iterable contains one or more non-promise values and/or an already settled promise, 
then &lt;code&gt;Promise.race()&lt;/code&gt; will settle to the first of these values found in the iterable.
&lt;/p&gt;

&lt;p&gt;
See this example:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
const promise1 = new Promise((resolve, reject) =&gt; {
  setTimeout(reject, 100, 'promise1 rejected');
});

const promise2 = new Promise((resolve, reject) =&gt; {
  reject('promise2 rejected');
});

Promise.race([promise1, promise2])
.then((value) =&gt; {
  console.log(value);
})
// promise2 is already settled (rejected), 
// so the 'error' will be the rejection-error of promise2
.catch((error) =&gt; { console.error(error);})
;

&lt;/pre&gt;

&lt;p&gt;
Output will be :
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
promise2 rejected
&lt;/pre&gt;

&lt;p&gt;
Since &lt;code&gt;promise2&lt;/code&gt; is already settled (rejected), &lt;code&gt;Promise.race()&lt;/code&gt; method will return &lt;code&gt;promise2&lt;/code&gt;.
&lt;/p&gt;


&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/race" target="_blank"&gt;
MDN Web Docs - Promise.race()
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/03/javascript-what-is-promise.html" target="_blank"&gt;
JavaScript - What is Promise
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/04/typescript-promiseall.html" target="_blank"&gt;
TypeScript - Promise.all()
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/04/typescript-promiseallsettled.html" target="_blank"&gt;
TypeScript - Promise.allSettled()
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/05/typescript-promiseany.html" target="_blank"&gt;
TypeScript - Promise.any()
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item><item><title>TypeScript - Promise.any()</title><link>http://idreesdotnet.blogspot.com/2023/05/typescript-promiseany.html</link><category>JavaScript</category><category>TypeScript</category><author>noreply@blogger.com (Muhammad Idrees)</author><pubDate>Thu, 4 May 2023 16:05:00 +0500</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-9038469203218287370.post-8088040154429878436</guid><description>
&lt;p&gt;
The &lt;code&gt;Promise.any()&lt;/code&gt; method is useful for returning the first promise that fulfills. It short-circuits after a promise fulfills, 
so it does not wait for the other promises to complete once it finds one.
&lt;/p&gt;


&lt;p&gt;
This method returns the first fulfilled value and ignores all rejected promises up until the first promise that fulfills. This can be beneficial if we need only one promise to fulfill but we do not care which one does. 
&lt;/p&gt;

&lt;p&gt;
Lets see an example:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
const p1 = Promise.reject("some error");
const p2 = Promise.resolve("resolve value1");
const p3 = Promise.resolve("resolve value2");

const promises = [p1, p2, p3];

(Promise as any).any(promises)
.then((value) =&gt; console.log(value))
.catch((error) =&gt; { console.error(error.message);});

&lt;/pre&gt;

&lt;p&gt;
Output will be :
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
resolve value1
&lt;/pre&gt;


&lt;p&gt;
In this example, the first promise &lt;code&gt;p1&lt;/code&gt; is rejected, but &lt;code&gt;Promise.any&lt;/code&gt; method ignores this and continue to the next promise &lt;code&gt;p2&lt;/code&gt; which get resolved/fulfilled. Once it finds the first fulfilled promise it stops processing further promises.
&lt;/p&gt;

&lt;p&gt;
If all of the input promises are rejected, then it rejects with an &lt;code&gt;AggregateError&lt;/code&gt; containing an array of rejection reasons.
&lt;/p&gt;

&lt;p&gt;
See this example:
&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
const p1 = Promise.reject("some error1");
const p2 = Promise.reject("some error2");
const p3 = Promise.reject("some error3");

const promises = [p1, p2, p3];

(Promise as any).any(promises)
.then((value) =&gt; console.log(value))
.catch((error) =&gt; { console.error(error);});

&lt;/pre&gt;

&lt;p&gt;
Output will be :
&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;
[AggregateError: All promises were rejected] {
  [errors]: [ 'some error1', 'some error2', 'some error3' ]
}
&lt;/pre&gt;


&lt;p&gt;
When all of the input promises are rejected, it generates the &lt;code&gt;AggregateError&lt;/code&gt; (array of the rejection error from each input promise).
&lt;/p&gt;


&lt;p&gt;
&lt;h3&gt;
References:
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/any" target="_blank"&gt;
MDN Web Docs - Promise.any()
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;

&lt;p&gt;
&lt;h3&gt;
Related Post(s):
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/03/javascript-what-is-promise.html" target="_blank"&gt;
JavaScript - What is Promise
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/04/typescript-promiseall.html" target="_blank"&gt;
TypeScript - Promise.all()
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/04/typescript-promiseallsettled.html" target="_blank"&gt;
TypeScript - Promise.allSettled()
&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://idreesdotnet.blogspot.com/2023/05/typescript-promiserace.html" target="_blank"&gt;
TypeScript - Promise.race()
&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
</description><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></item></channel></rss>