Skip to content

Instantly share code, notes, and snippets.

View tungptvn's full-sized avatar

Tung Pham tungptvn

  • Ho Chi Minh city
View GitHub Profile
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
namespace UnitTest
{
//EF core 3.1
public static class IQueryableExtensions
{
public static string ToSql<TEntity>(this IQueryable<TEntity> query) where TEntity : class
{
var enumerator = query.Provider.Execute<IEnumerable<TEntity>>(query.Expression).GetEnumerator();
var relationalCommandCache = enumerator.Private("_relationalCommandCache");
var server = require('../server');
var ds = server.dataSources.db;
var lbTables =
[
'User', 'AccessToken', 'ACL', 'RoleMapping', 'Role',
'AnswersForAQuestion','ApplicationUser','Question','Quiz','UsersQuizs'
];
ds.automigrate(lbTables, function(er) {
if (er) throw er;
console.log('Loopback tables [' + lbTables + '] created in ', ds.adapter.name);
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=301879
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<template>
<select value.bind="selected">
<option repeat.for="item of arr" value.bind="item.value">${item.label}</option>
</select>
</template>
//https://github.com/tungptvn/co
const co = function (fn) {
var gen = fn()
return new Promise((reslove, reject) => {
var queue = []
function resume(data) {
if (data.done) {
reslove(Promise.all(queue))
return
//https://github.com/tungptvn/co
const co = function (fn) {
var gen = fn()
return new Promise((reslove, reject) => {
var queue = []
function resume(data) {
if (data.done) {
reslove(Promise.all(queue))
return
@tungptvn
tungptvn / app.html
Created June 14, 2017 17:00 — forked from anonymous/app.html
Aurelia RequireJS Gist
<template>
<require from="./my-element"></require>
<div class="content-panel">
<my-element task.bind="fc" on-completed.call="updateDescription()" save.delegate="parentMethod($event)"></my-element>
</div>
parentProperty = '${parentProperty}'
</template>
{
"name": "AnswersForAQuestion",
"base": "PersistedModel",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {
"questionId": {
"type": "number",