Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kamarudin k4m4r82

🏠
Working from home
View GitHub Profile
View DemoPlugin.cs
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Load plugin cetak nota..\n");
var loader = new PluginLoader();
loader.LoadPlugins();
foreach (var plugin in PluginLoader.Plugins)
View ProductRepository.cs
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Dapper.Contrib.Extensions;
using NorthwindApi.Model.Context;
using NorthwindApi.Model.Entity;
View IBaseRepository.cs
using System.Collections.Generic;
using System.Threading.Tasks;
namespace NorthwindApi.Model.Repository
{
public interface IBaseRepository<T>
where T : class
{
Task<int> Save(T obj);
Task<int> Update(T obj);
View Product.cs
using Dapper.Contrib.Extensions;
namespace NorthwindApi.Model.Entity
{
[Table("products")]
public class Product
{
[ExplicitKey]
public string product_code { get; set; }
public string product_name { get; set; }
View DbContext.cs
using System;
using System.Data;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MySql.Data.MySqlClient;
namespace NorthwindApi.Model.Context
{
public interface IDbContext : IDisposable
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@k4m4r82
k4m4r82 / MahasiswaRepository.cs
Created Nov 27, 2019
Contoh class MahasiswaRepository
View MahasiswaRepository.cs
using System;
using System.Collections.Generic;
using System.Data.OleDb;
using PerpustakaanAppMVC.Model.Entity;
using PerpustakaanAppMVC.Model.Context;
namespace PerpustakaanAppMVC.Model.Repository
{
public class MahasiswaRepository
@k4m4r82
k4m4r82 / app.config.json
Created Aug 2, 2019
Contoh file konfigurasi aplikasi menggunakan format JSON
View app.config.json
{
"server": "192.168.1.1",
"database": "DbOpenRetail",
"port": 5432
}
@k4m4r82
k4m4r82 / app.config.xml
Created Aug 2, 2019
Contoh file konfigurasi aplikasi menggunakan format XML
View app.config.xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="server" value="192.168.1.1" />
<add key="database" value="DbOpenRetail" />
<add key="port" value="5432" />
</appSettings>
</configuration>
@k4m4r82
k4m4r82 / app.config.ini
Created Aug 2, 2019
Contoh file konfigurasi aplikasi menggunakan format INI
View app.config.ini
[database]
server=192.168.1.1
database=DbOpenRetail
port=5432
You can’t perform that action at this time.