Skip to content

Instantly share code, notes, and snippets.

View ebicoglu's full-sized avatar
:octocat:
Full stack developer

Alper Ebiçoğlu ebicoglu

:octocat:
Full stack developer
View GitHub Profile
@ebicoglu
ebicoglu / AbpAjaxResponse
Created August 23, 2017 06:49
Logining to AspNet Zero Website and get Access Token for api request via RestSharp
public class AjaxResponse<TResult> : AjaxResponseBase
{
/// <summary>
/// The actual result object of AJAX request.
/// It is set if <see cref="AjaxResponseBase.Success"/> is true.
/// </summary>
public TResult Result { get; set; }
/// <summary>
/// Creates an <see cref="AjaxResponse"/> object with <see cref="Result"/> specified.
@ebicoglu
ebicoglu / TenantAppService.cs
Last active April 17, 2018 07:19
[AspNet Zero] Drop tenant database when a tenant is deleted (for db for tenant usage)
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Abp;
using Abp.Application.Features;
using Abp.Application.Services.Dto;
using Abp.Authorization;
using Abp.Authorization.Users;
using Abp.Data;
@ebicoglu
ebicoglu / AbpDynamicSettingService.cs
Last active May 9, 2018 06:10
Aspnet Boilerplate Dynamic Setting Service via repository
using System.Linq;
using Abp.Collections.Extensions;
using Abp.Configuration;
using Abp.Dependency;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
namespace MyCompanyName.AbpZeroTemplate.MySettingService
{
public class DynamicSettingService : ITransientDependency
I made a super cool extension method that returns whether the selection is included in a GraphQL query.
---
## Extension Method
using System;
using System.Linq;
using GraphQL.Language.AST;
using GraphQL.Types;
@ebicoglu
ebicoglu / Customize-abp-login-page.md
Last active March 25, 2020 07:22
Override account/default.cshtml

How to customize the UI of ABP Commercial MVC project

I'll make an example with the Acme.BookStore project and modify the login page of the ABP Commercial MVC template.

To replace a view/CSS with a new one, rename your new file as the original one and put it in the same directory with the original directory path.

For this example, I'll overwrite Account/Login page. Below is the content of my customized login view. Create a file named Default.cshtml and put it in the folder *Acme.BookStore\src\Acme.BookStore.Web\Themes\Lepton\Layouts\Account*

  1. Open Acme.BookStore.IdentityServer.csproj project and add the below package reference:
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0" />

  1. Add the below code into ConfigureServices() method of BookStoreIdentityServerModule.cs
@ebicoglu
ebicoglu / BookStoreDomainModule.cs
Last active May 11, 2020 10:39
How to show entity change history on a new entity in ABP MVC?
public override void ConfigureServices(ServiceConfigurationContext context)
{
//...
Configure<AbpAuditingOptions>(options =>
{
options.EntityHistorySelectors.AddAllEntities();
});
}
@ebicoglu
ebicoglu / EfCoreSequentialNumberRepository.cs
Created May 29, 2020 06:57
Creating Sequential Numbers
public class EfCoreSequentialNumberRepository : EfCoreRepository<IQaDbContext, SequentialNumber, Guid>, ISequentialNumberRepository
{
public EfCoreSequentialNumberRepository(IDbContextProvider<IQaDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public virtual SequentialNumber FindBySequenceName(string sequenceName)
{
var abp = abp || {};
$(function () {
abp.modals.apiResourceUpdate = function () {
var initModal = function (publicApi, args) {
var l = abp.localization.getResource('AbpIdentityServer');
var $form = publicApi.getForm();
var getUniqueId = function () {
@ebicoglu
ebicoglu / sql-find-missing-index.sql
Created August 11, 2020 10:09
Finds missing indexes for SQL
SELECT
OBJECT_NAME(id.[object_id], db.[database_id]) AS [Table]
,id.[equality_columns] AS [EqualityColumns]
,id.[inequality_columns] AS [InEqualityColumns]
,id.[included_columns] AS [IncludedColumns]
,gs.[avg_total_user_cost] AS [UserCost] -- Average cost of the user queries that could be reduced by the index in the group.
,gs.[avg_user_impact] AS [QueryBoostImpact] -- The value means that the query cost would on average drop by this percentage if this missing index group was implemented.
,gs.[user_seeks] * gs.[avg_total_user_cost] * (gs.[avg_user_impact] * 0.01) AS [IndexAdvantage]
,'CREATE INDEX [IX_' + OBJECT_NAME(id.[object_id], db.[database_id]) + '_' + REPLACE(REPLACE(REPLACE(ISNULL(id.[equality_columns], ''), ', ', '_'), '[', ''), ']', '') + CASE