Skip to content

Instantly share code, notes, and snippets.

View uhaciogullari's full-sized avatar

Ufuk Hacıoğulları uhaciogullari

View GitHub Profile
# first folder contains the csproj you want to package
# second folder is the relative path to your nuget feed folder from the library folder
dotnet pack -c Release ./src/Trail.Common -o ./../../../nuget-feed
# switch to feed folder
cd ../nuget-feed
# add new package
git add -A
@uhaciogullari
uhaciogullari / ModelBuilderExtensions.cs
Created November 15, 2017 23:43
Use Postgres naming conventions in EF Core
static class ModelBuilderExtensions
{
public static void UsePostgresConventions(this ModelBuilder modelBuilder)
{
foreach (var entity in modelBuilder.Model.GetEntityTypes())
{
// Replace table names
entity.Relational().TableName = entity.Relational().TableName.ToSnakeCase();
// Replace column names
@uhaciogullari
uhaciogullari / DefaultInstaller.cs
Last active August 29, 2015 14:13
Windsor Installer
public class DefaultInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(Classes.FromThisAssembly().IncludeNonPublicTypes().Pick().WithServiceAllInterfaces().LifestyleSingleton());
container.Register(Component.For<ILogger>().Instance(new LoggerAdapter(LogManager.GetCurrentClassLogger())));
}
}
@uhaciogullari
uhaciogullari / Global.asax
Last active August 29, 2015 14:12
ASP.NET MVC - Castle Windsor
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
WindsorBootstrapper.CreateBootstrapContainer();
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
protected void Application_End()
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logInfoToFile" xsi:type="File" fileName="${basedir}/../Logs/${shortdate}/InfoLog.txt" layout="${date:format=HH\:mm\:ss\:fff}|${message}" />
<target name="logErrorToFile" xsi:type="File" fileName="${basedir}/../Logs/${shortdate}/ErrorLog.txt" layout="${date:format=HH\:mm\:ss\:fff}|${message}|${exception:format=tostring}" />
<target name="logWarnToFile" xsi:type="File" fileName="${basedir}/../Logs/${shortdate}/WarningLog.txt" layout="${date:format=HH\:mm\:ss\:fff}|${message}" />
</targets>
<rules>
<logger name="*" levels="Info" writeTo="logInfoToFile" />
<logger name="*" levels="Error" writeTo="logErrorToFile" />
@uhaciogullari
uhaciogullari / FileTemplates.DotSettings
Last active December 24, 2015 20:09
ReSharper templates
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=C8C772595BBC034583354C481049638F/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=C8C772595BBC034583354C481049638F/Description/@EntryValue">NUnit Test Fixture</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=C8C772595BBC034583354C481049638F/Text/@EntryValue">$HEADER$namespace $NAMESPACE$&#xD;
{&#xD;
[NUnit.Framework.TestFixture]&#xD;
public class $CLASS$&#xD;
{&#xD;
&#xD;
[NUnit.Framework.SetUp]&#xD;
@uhaciogullari
uhaciogullari / SchemaCreator.cs
Last active December 24, 2015 06:29
NUnit test for creating schema with NHibernate
[TestFixture]
[Category("DatabaseSchema")]
[Explicit]
//nunit-console "TestAssembly.dll" /include:DatabaseSchema /framework=4.0.30319
public class SchemaCreator
{
[Test]
public void CreateSchemaScript()
{
ISchemaManager schemaManager = new SchemaManager(new ConfigurationBuilder().BuildConfiguration());