Skip to content

Instantly share code, notes, and snippets.

View oguzhankircali's full-sized avatar
:octocat:
Creating a product

Oğuzhan Kırçalı oguzhankircali

:octocat:
Creating a product
View GitHub Profile
public static List<KeyValuePair<TEnum, string>> ToEnumDescriptionsList<TEnum>()
{
return ToEnumDescriptionsList<TEnum>(default(TEnum));
}
public static List<KeyValuePair<TEnum, string>> ToEnumDescriptionsList<TEnum>(this TEnum value)
{
return Enum
.GetValues(typeof(TEnum))
public static DateTime GetLinkerTime(this Assembly assembly, TimeZoneInfo target = null)
{
var filePath = assembly.Location;
const int c_PeHeaderOffset = 60;
const int c_LinkerTimestampOffset = 8;
var buffer = new byte[2048];
using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
stream.Read(buffer, 0, 2048);
public static string HostIPAddress
{
get
{
if (HttpContext.Current.Application["HostIPAddress"] == null)
{
try
{
IPHostEntry ipHostInfo = Dns.GetHostEntry(Dns.GetHostName());
public static string VersionInfo
{
get
{
if (HttpContext.Current.Application["VersionInfo"] == null)
{
HttpContext.Current.Application["VersionInfo"] = Assembly.GetExecutingAssembly().GetLinkerTime().ToString();
}
declare @Alan1 int
declare @Alan2 nvarchar(100)
declare cur cursor for
select Alan1,Alan2 from @t
open cur
fetch next from cur into @Alan1,@Alan2
--search in all cells
declare @SearchStr nvarchar(100)
set @SearchStr='ECZACILIK FAKÜLTESİ B'
declare @Results TABLE (ColumnName nvarchar(370), ColumnValue nvarchar(3630))
SET NOCOUNT ON
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ''
public class CommonResponse
{
public bool IsSuccess { get; set; }
public string Message { get; set; }
public object Object { get; set; }
public CommonResponse()
{
}
@oguzhankircali
oguzhankircali / Precision.cs
Created October 17, 2018 10:53
Set Precision of Decimal Property on DB Context
modelBuilder.Entity<PolicyInsuredFactor>().Property(e => e.Multiplier).HasPrecision(30, 16);
//TR: Bu metodu çağıran metotlarda rollback olduğundan, loglamayı etkilemesin diye RequiresNew attribute'u ekleniyor.
//Bu sayede metodun bitmesini beklemeden commit etmiş oluyor
//EN: Parent method of this have rollback features, but i want to log it,
//because of this i added TransactionScopeOption.RequiresNew to unit of work
var unitOfWorkManager = IocManager.Instance.Resolve<IUnitOfWorkManager>();
using (var unitOfWork = unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
{
_serviceLogManager.InsertOrUpdateAndGetId(this.ServiceLogEntity);
@oguzhankircali
oguzhankircali / SoapBehavior.cs
Last active June 10, 2019 17:43
SOAP Logging (Log all incoming and outgoing xml)
using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Linq;
using SoapLogging.Database;
namespace SoapLogging.Common
{
public class SoapBehavior : IEndpointBehavior, IClientMessageInspector