Skip to content

Instantly share code, notes, and snippets.

View maliming's full-sized avatar
🏠
Working from home

maliming

🏠
Working from home
View GitHub Profile
using System;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
namespace CascadeTimingDemo
{
/*
[Route("api/testapi/test0api")]
public class Test0Controller : MyProjectNameController
{
[HttpGet]
[Route("Get")]
[Authorize]
public string TestMethod()
{
return "test";
}
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.RequestLocalization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Primitives;
EdmProperty GetEdmProperty(Type type, string propertyName)
{
var metadata = ((IObjectContextAdapter)this).ObjectContext.MetadataWorkspace;
var objectItemCollection = ((ObjectItemCollection)metadata.GetItemCollection(DataSpace.OSpace));
var entityType = metadata.GetItems<EntityType>(DataSpace.OSpace).Single(t => objectItemCollection.GetClrType(t) == type);
var entitySet = metadata.
GetItems<EntityContainer>(DataSpace.SSpace)
namespace System.Transactions
{
//
// 摘要:
// 指定事务的隔离级别。
public enum IsolationLevel
{
//
// 摘要:
// 易失数据可以读取但不是会修改,并在事务处理期间,可以添加任何新数据。
@maliming
maliming / web.config
Created May 23, 2017 02:50
angular iis router
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="angular routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@maliming
maliming / AccountController.cs
Created May 8, 2017 00:56 — forked from hikalkan/AccountController.cs
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
using System;
using System.IO;
using System.Linq;
using System.Text;
namespace AbpWebSite.Templates
{
/// <summary>
/// Used to rename a solution
/// </summary>