http://dl.dropbox.com/u/29703851/js/demo/index.html
这是示范.
我想使用100%宽度的flexslider,但是当鼠标光标在flexslider之外时,我得到了奇怪的额外宽度和水平滚动条.
当我浏览flexslider时,水平滚动消失.有什么建议吗?
我使用演示代码,没有css更改,没有js更改.刚刚删除了所有div,并且只留下了一个带有flexslider类的div.
有100%宽度的正确方法吗?
我创建了一个功能,可以防止同时为一个用户名进行多次登录,我在这样的操作中调用它:
int userId = (int)WebSecurity.CurrentUserId;
if ((this.Session.SessionID != dba.getSessionId(userId)) || dba.getSessionId(userId) == null)
{
WebSecurity.Logout();
return RedirectToAction("Index", "Home");
}
Run Code Online (Sandbox Code Playgroud)
所以关键是每次用户登录时我都会将他的sessionID保存到数据库字段中.因此,如果具有相同用户名的某人登录已使用相同用户名登录的某人,则会使用此新会话覆盖该数据库字段.如果DB中的sessionID与登录用户的当前会话ID不同,则将其记录下来.
有可能将这部分代码放在一个地方,还是我必须把它放在我的应用程序中的每一个Action中?
我试过Global.asax:
void Application_BeginRequest(object sender, EventArgs e)
{
if (Session["ID"] != null)
{
int userId = Convert.ToInt32(Session["ID"]);
if ((this.Session.SessionID != db.getSessionId(userId)) || db.getSessionId(userId) == null)
{
WebSecurity.Logout();
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我不能在这里使用Session,也不能使用WebSecurity类,如果我这样做:
void Application_BeginRequest(object sender, EventArgs e)
{
int userId = (int)WebSecurity.CurrentUserId;
if ((this.Session.SessionID != db.getSessionId(userId)) || db.getSessionId(userId) == null)
{
WebSecurity.Logout();
Response.RedirectToRoute("Default");
}
}
Run Code Online (Sandbox Code Playgroud)
因为我得到null引用异常.
编辑
我用过这个:
void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext) …Run Code Online (Sandbox Code Playgroud) 我的IQueryable看起来像这样:
IQueryable<TEntity> query = context.Set<TEntity>();
query = query.Include("Car").ThenInclude("Model");
Run Code Online (Sandbox Code Playgroud)
'IQueryable'不包含'ThenInclude'的定义,也没有扩展方法'ThenInclude'可以找到'IQueryable'类型的第一个参数(你是否缺少using指令或汇编引用?)
我需要所有参考资料:
using Content.Data.Models;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
Run Code Online (Sandbox Code Playgroud)
为什么它不识别ThenInclude?
查询:
[Content.Data.Models.Article]).Where(x => (((x.BaseContentItem.SiteId == value(Content.Business.Managers.ArticleManager+<>c__DisplayClass8_0).id) AndAlso x.BaseContentItem.IsActive) AndAlso x.BaseContentItem.IsLive)).Include("BaseContentItem").Include("BaseContentItem.TopicTag").Include("MainImage")}
Run Code Online (Sandbox Code Playgroud)
包含.Include("BaseContentItem.TopicTag")零件后失败.
所以我只是通过通用存储库读到你失去了ThenInclude.我正在使用这个通用代表:
public class ReadOnlyRepository<TContext> : IReadOnlyRepository
where TContext : DbContext
{
protected readonly TContext context;
public ReadOnlyRepository(TContext context)
{
this.context = context;
}
private IQueryable<TEntity> GetQueryable<TEntity>(
Expression<Func<TEntity, bool>> filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>> orderBy = null,
string includeProperties = null,
int? skip …Run Code Online (Sandbox Code Playgroud) 实体示例:
public class HistoryWorkoutExercise : EntityMaximum
{
/// <summary>
/// Gets or sets the Weight.
/// </summary>
public decimal? Weight { get; set; }
/// <summary>
/// Gets or sets the Speed.
/// </summary>
public decimal? Speed { get; set; }
/// <summary>
/// Gets or sets the Time.
/// </summary>
public decimal? Time { get; set; }
public int NumberOfRepetitions { get; set; }
public int NumberOfCompletedRepetitions { get; set; }
public int ExerciseId { get; set; }
public …Run Code Online (Sandbox Code Playgroud) 我正在从 appsettings.json 加载配置文件,其中保存了 api url。
我已经建立了 ngrx 7 商店,有效果。我在 app.component.ts onInit 中调度 loadconfig 操作,然后尝试从控制台中的存储读取数据。我收到一个错误:
类型错误:无法读取新 AppFacade 中未定义的属性“getConfig”(VM5613 main.js:2060)
我认为问题是我如何为 root 实现选择器。如您所见,我使用了 createFeatureSelector,但根状态不是功能,而是根。我究竟做错了什么?为什么我无法访问状态值,因为它说它是未定义的,但在 redux chrome devtools 状态中显然存在?
这就是我实现我的商店的方式:
操作:
import { Action } from '@ngrx/store';
import { AppConfig } from '../../app.config';
export enum AppActionTypes {
LoadConfig = '[App] Load Config',
LoadConfigError = '[App] Load Config Error',
LoadConfigSuccess = '[App] Load Config Success'
}
export class LoadConfig implements Action {
public readonly type = AppActionTypes.LoadConfig;
}
export class LoadConfigError implements Action …Run Code Online (Sandbox Code Playgroud) 我在Startup.cs中设置了我的净核心应用程序和防伪Middlweare:
services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
Run Code Online (Sandbox Code Playgroud)
在ConfigureServices方法中
app.UseAntiForgeryMiddleware();
Run Code Online (Sandbox Code Playgroud)
在配置方法中。
反伪造中间件:
public class AntiForgeryMiddleware
{
private readonly IAntiforgery antiforgery;
private readonly AntiforgeryOptions options;
private readonly RequestDelegate next;
public AntiForgeryMiddleware(RequestDelegate next, IAntiforgery antiforgery, IOptions<AntiforgeryOptions> options)
{
this.next = next;
this.antiforgery = antiforgery;
this.options = options.Value;
}
public async Task Invoke(HttpContext context)
{
try
{
if (string.Equals(context.Request.Path.Value, "/", StringComparison.OrdinalIgnoreCase) ||
string.Equals(context.Request.Path.Value, "/index.html", StringComparison.OrdinalIgnoreCase))
{
// We can send the request token as a JavaScript-readable cookie, and Angular will use it by default.
var …Run Code Online (Sandbox Code Playgroud) 如何使用 typescript 设置路径以与 ts-node 一起运行?然后编译的时候把路径编译成绝对路径?
koki.ts:
export const calculate = (a: number, b: number) => {
return a + b;
};
Run Code Online (Sandbox Code Playgroud)
index.ts:
import { calculate } from "@koki/koki";
const result = calculate(1, 2);
console.log(result);
Run Code Online (Sandbox Code Playgroud)
tsconfig.json:
{
"ts-node": {
"transpileOnly": true,
"require": ["tsconfig-paths/register"]
},
"compilerOptions": {
"target": "es2017",
"module": "commonjs",
"lib": ["dom", "es6", "es2017", "esnext.asynciterable"],
"skipLibCheck": true,
"sourceMap": true,
"outDir": "./dist",
"moduleResolution": "node",
"removeComments": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true, …Run Code Online (Sandbox Code Playgroud) 我正在使用EF 6.我试图插入大约200.000个实体,同时在每100个实体后保存对数据库的更改.
问题是需要11个小时来保存50.000个实体,它仍然落后.我正在使用WebJobs运行它,并且作业在与主网站相同的azure webapp上发布.是因为那个问题和WebJob没有足够的资源,或者在100个实体之后保存,还是方法?
方法
public void SaveLeadsForBuyer(ISenderModel model)
{
var rowCounter = 0;
foreach (var deliveryRecord in model.Customers.Select(customerModel => new DeliveryRecord()
{
BuyerId = model.Buyer.Id,
AspNetUserId = customerModel.Id,
DeliveryType = model.Buyer.DeliveryType,
CreatedOn = DateTime.UtcNow
}))
{
++rowCounter;
_unit.Repository<DeliveryRecord>().Insert(deliveryRecord);
_unit.SaveChangesPartially(rowCounter, 100);
}
_unit.SaveChanges();
}
Run Code Online (Sandbox Code Playgroud)
帮手
public static class UnitOfWorkHelper
{
/// <summary>
/// Helper method triggers SaveChanges() after amount of rows provided through "amount" parameter in method
/// </summary>
/// <param name="unit">UnitOfWork object</param>
/// <param name="count">Current amount of rows</param>
/// …Run Code Online (Sandbox Code Playgroud) c# ×5
asp.net-core ×2
typescript ×2
.net-core ×1
angular ×1
angularjs ×1
asp.net-mvc ×1
azure ×1
css ×1
flexslider ×1
html ×1
javascript ×1
jquery ×1
linq ×1
ngrx ×1
ngrx-store ×1
node.js ×1
redux ×1
tfs ×1