小编ame*_*els的帖子

Flexslider 100%宽度创建水平滚动条

http://dl.dropbox.com/u/29703851/js/demo/index.html

这是示范.

我想使用100%宽度的flexslider,但是当鼠标光标在flexslider之外时,我得到了奇怪的额外宽度和水平滚动条.

当我浏览flexslider时,水平滚动消失.有什么建议吗?

我使用演示代码,没有css更改,没有js更改.刚刚删除了所有div,并且只留下了一个带有flexslider类的div.

有100%宽度的正确方法吗?

html javascript css jquery flexslider

6
推荐指数
1
解决办法
6115
查看次数

允许一个人一次使用帐户的可重复使用方式

我创建了一个功能,可以防止同时为一个用户名进行多次登录,我在这样的操作中调用它:

        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)

asp.net-mvc

6
推荐指数
1
解决办法
405
查看次数

然后在EF Core查询中无法识别

我的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)

c# linq entity-framework entity-framework-core

6
推荐指数
2
解决办法
4441
查看次数

EF Core - 循环引用并序列化为 json

实体示例:

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)

entity-framework .net-core

6
推荐指数
1
解决办法
1418
查看次数

Ngrx 商店 - 如何选择根状态

我正在从 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)

typescript redux ngrx ngrx-store

6
推荐指数
1
解决办法
4438
查看次数

如何使用angular2应用程序和net core应用程序实现X-XSRF-TOKEN?

我在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)

c# angularjs asp.net-core angular

5
推荐指数
1
解决办法
1586
查看次数

如何将 tsconfig-paths 与 ts-node 一起使用

如何使用 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)

node.js typescript tsconfig-paths

4
推荐指数
1
解决办法
1万
查看次数

实体框架批量插入虚幻慢

我正在使用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# entity-framework azure azure-webjobs

3
推荐指数
1
解决办法
1282
查看次数

在tfs上删除自定义安装的构建任务

我在TFS上安装了一些自定义构建任务: 在此输入图像描述

我有相同任务的新版本,但无法更新: 在此输入图像描述

如何从tfs卸载自定义生成任务或如何使用新版本更新现有任务?

c# tfs

3
推荐指数
1
解决办法
1166
查看次数

net.core应用程序的远程调试不起作用

我有一个点网核心应用程序,我使用Debug-> Attach在Azure网站远程服务器上进行处理: 在此处输入图片说明

我附加到dotnet.exe进程,并且可以看到断点是红色的,这意味着符号已加载并可以进行调试。

问题是,当我访问该网站时,Visual Studio中什么也没有发生,因此由于某种原因它没有达到断点。这是附加到进程以远程调试Net Core App的正确方法吗?

c# remote-debugging asp.net-core

3
推荐指数
1
解决办法
962
查看次数