Find my latest knowledge clip.
Praveen's CTO Blog
Find my latest knowledge clip.
Note the point…
.NET 5.0 is the next major release of .NET Core following 3.1. We named this new release .NET 5.0 instead of .NET Core 4.0 for two reasons:
ASP.NET Core 5.0 is based on .NET 5.0 but retains the name “Core” to avoid confusing it with ASP.NET MVC 5. Likewise, Entity Framework Core 5.0 retains the name “Core” to avoid confusing it with Entity Framework 5 and 6.
Ref: https://docs.microsoft.com/en-us/dotnet/core/dotnet-five
This code snippets will let you auto-generate strong passwords. Look for the password rules in the inline comments in code
This blog demonstrates how you can JOIN (yes, like in SQL) two xml (datasets) to one using a common ID (relationship).
shop.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='main.xsl'?>
<shop>
<product>
<id>100</id>
<title>hello</title>
</product>
<product>
<id>101</id>
<title>world</title>
</product>
<product>
<id>102</id>
<title>praveen</title>
</product>
</shop>
price.xml
<?xml version="1.0" encoding="UTF-8"?>
<shop>
<product>
<id>100</id>
<price>10.0</price>
</product>
<product>
<id>101</id>
<price>10.1</price>
</product>
<product>
<id>102</id>
<price>10.2</price>
</product>
<product>
<id>103</id>
<price>10.3</price>
</product>
</shop>
main.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:param name="fileName" select="'price.xml'" />
<xsl:variable name="updateItems" select="document($fileName)/shop/product" />
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
<xsl:copy-of select="$updateItems[id=current()/id]/price" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Resulting XML, after transformation should look like:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type='text/xsl' href='main.xsl'?>
<shop>
<product>
<id>100</id>
<title>hello</title>
<price>10.0</price>
</product>
<product>
<id>101</id>
<title>world</title>
<price>10.1</price>
</product>
<product>
<id>102</id>
<title>praveen</title>
<price>10.2</price>
</product>
</shop>
Bonus code, if some .net developers want a transformation code:
XslTransform xslt = new XslTransform();
xslt.Load(@"D:\Websites\xmltest\main.xsl");
xslt.Transform(@"D:\Websites\xmltest\shop.xml", @"D:\Websites\xmltest\out.xml");
textBox1.Text = System.IO.File.ReadAllText(@"D:\Websites\xmltest\out.xml");
Sending a mail using Office365 is no big deal. It is just similar to how you send a mail via any SMTP server. But you will have to mind the SMTP host, port number and remember to enable SSL in the code. Here goes the code snippet:
using (MailMessage message = new MailMessage())
{
message.From = new MailAddress("praveen@YourO365Domain.com");
message.To.Add("praveen@yourmail.com");
message.Subject = "test mail";
message.Body = "<h1>test</h1>";
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient("outlook.office365.com", 587);
client.Credentials = new NetworkCredential("praveen@YourO365Domain.com", "passwordhere");
client.EnableSsl = true;
client.Send(message);
}