Skip to content

Commit

Permalink
chore: Fix debugger project
Browse files Browse the repository at this point in the history
  • Loading branch information
data-miner00 committed Jan 3, 2024
1 parent b8fbe86 commit bd42109
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Linker.Debugger/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="Default" connectionString="Data Source=C:\Users\User\Downloads\person.db;Version=3;" providerName="System.Data.SqlClient"/>
<add name="Default" connectionString="Data Source=D:\Workspace\Visual Studio\Linker\src\db.sqlite;Version=3;" providerName="System.Data.SqlClient"/>
</connectionStrings>
</configuration>
10 changes: 10 additions & 0 deletions src/Linker.Debugger/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:Elements should be documented", Justification = "This is a debugging project")]
[assembly: SuppressMessage("Minor Code Smell", "S1481:Unused local variables should be removed", Justification = "This is a debugging project")]
[assembly: SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "This is a debugging project")]
77 changes: 60 additions & 17 deletions src/Linker.Debugger/Program.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,81 @@
namespace Linker.Debugger
{
using System;
using System.Configuration;
using System.Data;
using System.Data.SQLite;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Timers;
using Dapper;
using Linker.Core.Models;
using Linker.Data.SQLite;

internal class Program
internal static class Program
{
static void Main(string[] args)
public static void Main(string[] args)
{
using (var connection = new SQLiteConnection(LoadConnectionString()))
{
var websiteRepo = new WebsiteRepository(connection);
var tagRepo = new TagRepository(connection);
goto some;
some:
var tags = tagRepo.GetAllAsync().GetAwaiter().GetResult();

var website = new Website
Console.WriteLine(tags);
}
}

public static async Task AddArticle(IDbConnection connection)
{
var articleRepo = new ArticleRepository(connection);

await articleRepo.AddAsync(
new Article
{
Id = "new",
Url = "sample.com",
Id = Guid.NewGuid().ToString(),
Url = "sample.com/article.htm",
Category = Category.Finance,
Description = "no desc",
Tags = new List<string> { "tag1", "tag2" },
Description = "long desc",
Tags = new List<string> { "tag1", "tag2", "new TAG!!!" },
Language = Language.Japanese,
LastVisitAt = DateTime.Now,
CreatedAt = DateTime.Now,
ModifiedAt = DateTime.Now,
Name = "noname",
Domain = "doamin.com",
Aesthetics = Aesthetics.Clean,
IsSubdomain = false,
IsMultilingual = false,
};

websiteRepo.Add(website);
}
Title = "Crummy title",
Author = "Jim Cramer",
Year = 2014,
WatchLater = true,
Domain = "www.google.com",
Grammar = Grammar.Average,
},
CancellationToken.None);

await articleRepo.GetAllAsync(CancellationToken.None);
}

public static async Task AddYoutube(IDbConnection connection)
{
var youtubeRepo = new YoutubeRepository(connection);
await youtubeRepo.UpdateAsync(
new Youtube
{
Id = "ae58d402-b7a4-4e69-97d6-30ebcad741c5",
Url = "youtube.com/dahuhffd",
Category = Category.Finance,
Description = "A C# professional guru",
Tags = new List<string> { "c#", "unity", "f#" },
Language = Language.English,
LastVisitAt = new DateTime(1994, 4, 5, 0, 0, 0, DateTimeKind.Utc),
CreatedAt = new DateTime(2022, 4, 5, 0, 0, 0, DateTimeKind.Utc),
ModifiedAt = DateTime.Now,
Name = "Brackeys",
Youtuber = "Johnson",
Country = "Canada",
},
CancellationToken.None);

var all = await youtubeRepo.GetAllAsync(CancellationToken.None);
}

private static string LoadConnectionString(string id = "Default")
Expand Down

0 comments on commit bd42109

Please sign in to comment.