Skip to content

Instantly share code, notes, and snippets.

Ufuk Hacıoğulları uhaciogullari

View GitHub Profile
View pack.sh
# 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 Nov 15, 2017
Use Postgres naming conventions in EF Core
View ModelBuilderExtensions.cs
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
View DefaultInstaller.cs
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 Aug 29, 2015
ASP.NET MVC - Castle Windsor
View Global.asax
public class MvcApplication : HttpApplication
{
protected void Application_Start()
{
WindsorBootstrapper.CreateBootstrapContainer();
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
protected void Application_End()
View NLog.config
<?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" />
View FileTemplates.DotSettings
<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 Dec 24, 2015
NUnit test for creating schema with NHibernate
View SchemaCreator.cs
[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());
You can’t perform that action at this time.