Skip to content

Instantly share code, notes, and snippets.

View hikalkan's full-sized avatar

Halil İbrahim Kalkan hikalkan

View GitHub Profile
@hikalkan
hikalkan / gist:58b2eb983e7b7dae0d1b
Created September 21, 2014 18:38
Working Kendo with ABP sample codes
//Create a base class for common parameters
public class KendoInputDto : IInputDto
{
public int Take { get; set; }
public int Skip { get; set; }
public IEnumerable<Sort> Sort { get; set; }
public Filter Filter { get; set; }
}
@hikalkan
hikalkan / gist:1e5d0f0142484da994e0
Created October 15, 2014 05:42
Castle Windsor interceptor for async methods
class Program
{
static void Main(string[] args)
{
using (var container = new WindsorContainer())
{
container.Register(
Component.For<MyInterceptor>().LifestyleTransient(),
Component.For<MyTester>().Interceptors<MyInterceptor>().LifestyleTransient()
);
@hikalkan
hikalkan / MyModule.cs
Last active July 2, 2021 05:54
Simple console application with ABP and EF.
[DependsOn(typeof(AbpEntityFrameworkModule))]
public class MyModule : AbpModule
{
public override void Initialize()
{
IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
}
}
@hikalkan
hikalkan / Unit test exception message
Last active August 29, 2015 14:17
Effort.Ef6 & EntityFramework.DynamicFilters combine problem
System.NullReferenceExceptionObject reference not set to an instance of an object.
at Effort.Internal.CommandActions.DbCommandActionHelper.FormatParameters(IList`1 source, IList`1 description, ITypeConverter converter)
at Effort.Internal.CommandActions.QueryCommandAction.ExecuteDataReader(ActionContext context)
at Effort.Provider.EffortEntityCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.Execu
public partial class Create_Indexes_For_Module_Zero_Tables : DbMigration
{
public override void Up()
{
DropIndex("AbpPermissions", new[] { "UserId" });
DropIndex("AbpPermissions", new[] { "RoleId" });
DropIndex("AbpRoles", new[] { "TenantId" });
DropIndex("AbpSettings", new[] { "TenantId" });
DropIndex("AbpSettings", new[] { "UserId" });
DropIndex("AbpUserLogins", new[] { "UserId" });
@hikalkan
hikalkan / GetScenariosInput.cs
Last active August 29, 2015 14:26
jTable ABP adapter
public class GetScenariosInput : IPagedResultRequest, ISortedResultRequest, IShouldNormalize
{
public int MaxResultCount { get; set; }
public int SkipCount { get; set; }
public string Sorting { get; set; }
public bool? IsActive { get; set; }
public GetScenariosInput()
{
@hikalkan
hikalkan / CallApiFromConsole-Program.cs
Last active August 16, 2022 22:16
This code shows how to login to an ASP.NET ZERO (http://aspnetzero.com) based application and call an application service method remotely.
using System;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Abp;
using Abp.Application.Services.Dto;
using Abp.Dependency;
using Abp.Domain.Entities.Auditing;
using Abp.Extensions;
@hikalkan
hikalkan / AccountController.cs
Last active March 20, 2020 07:10
User Impersonation for ASP.NET Boilerplate
/* SAMPLE AJAX CALL to this action:
(This is enough since it's automatically redirected to the target tenant's ImpersonateSignIn action)
abp.ajax({
url: abp.appPath + 'Account/Impersonate',
data: JSON.stringify({
tenantId: 1, //Target tenant id (can be null if target user is a host user)
userId: 2 //Target user id
})
@hikalkan
hikalkan / Global.asax.cs
Created January 2, 2016 21:52
Enabling Serilog in an ABP based Web project
//Remove this:
AbpBootstrapper.IocManager.IocContainer
.AddFacility<LoggingFacility>(f => f.UseLog4Net()
.WithConfig("log4net.config")
);
//Add this:
AbpBootstrapper.IocManager.IocContainer.Register(
@hikalkan
hikalkan / AccountController.cs
Created January 13, 2016 16:25
Adding a new property to session
//Add new property to claims on login
private async Task SignInAsync(User user, ClaimsIdentity identity = null, bool rememberMe = false)
{
if (identity == null)
{
identity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
}
identity.AddClaim(new Claim("Application_UserEmail", user.EmailAddress)); //SETTING NEW PROPERTY