This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="nav navbar-nav navbar-right"> | |
<li><a href="/Identity/Account/Register">Register</a></li> | |
<li><a href="/Identity/Account/Login">Login</a></li> | |
</ul> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddIdentity<IdentityUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128) | |
.AddEntityFrameworkStores<IdentityDbContext>() | |
.AddDefaultUI() | |
.AddDefaultTokenProviders(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Inject } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
@Component({ | |
selector: 'app-fetch-data', | |
templateUrl: './fetch-data.component.html' | |
}) | |
export class FetchDataComponent { | |
public forecasts: WeatherForecast[]; | |
public cacheForecasts: WeatherForecast[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AppSettings": { | |
"SQLConnectionString": "Server=DESKTOP-AT25PLJ\\SQLEXPRESS; Database=SampleDB;user=sa;password=pass@123;Trusted_Connection=False;", | |
"SourceDirectoryPath": "C:\\Temp", | |
"MySQLConnectionString": "Server=localhost;Database=sampledb;Uid=root;Pwd=pass@123;", | |
"DestinationDirectoryPath": "C:\\Temp" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Populate(DataTable dt, string tableName) | |
{ | |
if (dt.Rows.Count == 0) return; | |
try | |
{ | |
string truncateQuery = "Truncate Table `" + tableName + "`;"; //First truncate the table | |
using (MySqlConnection connection = new MySqlConnection(_connectionString)) | |
{ | |
using (MySqlCommand command = new MySqlCommand()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void TransferData(DataSet ds) | |
{ | |
try | |
{ | |
DisableForeignKey(true); | |
if (ds != null) | |
{ | |
foreach (DataTable dt in ds.Tables) | |
{ | |
Populate(dt, dt.TableName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public bool Import(string url = "") | |
{ | |
WriteToConsole("** MySql Data Export Started**"); | |
bool bValue = true; | |
string newFileName = "Dbdata.xml.gz"; | |
string filePath = Path.Combine(_directoryPath, newFileName); | |
if(url != "") | |
bValue = DownloadFile(url, filePath); | |
if (bValue) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void DisableForeignKey(bool flag) | |
{ | |
string query = ""; | |
if (flag) | |
query = "SET FOREIGN_KEY_CHECKS=0;"; | |
else | |
query = "SET FOREIGN_KEY_CHECKS=1;"; | |
try | |
{ | |
using (MySqlConnection connection = new MySqlConnection(_connectionString)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var services = new ServiceCollection(); | |
ConfigureServices(services); | |
var provider = services.BuildServiceProvider(); | |
Console.WriteLine("** Welcome to Data Transfer tool **"); | |
Console.WriteLine("** Please select one of the following option **"); | |
Console.WriteLine("** [1] - Enter 1 for extracting data from SQL Server Data **"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MySQLDataImport | |
{ | |
private const int cBatchCount = 2000; | |
private string _connectionString = ""; | |
private string _directoryPath = ""; | |
public MySQLDataExport(IConfigurationRoot config) | |
{ | |
_connectionString = config["AppSettings:MySQLConnectionString"]; |