小编Nic*_*lai的帖子

底部三角形覆盖另一个图像的图像

在图像底部创建箭头很简单.

但是,如果第二张图像不是背景而是第一张图像之后的另一张图像,这是否可能达到这样的效果: 图像底部三角形图像

我在codepen.io上创建了"pen"

.wrap {
  position: relative;
  overflow: hidden;
  width: 70%;
  height: 200px;
  margin: 0 auto;
}
.wrap img {
  width: 100%;
  height: auto;
  display: block;
}
.arrow {
  position: absolute;
  bottom: 0;
  width: 100%;
}
.arrow:before,
.arrow:after {
  content: '';
  position: absolute;
  bottom: 100%;
  width: 50%;
  box-sizing: border-box;
}
.arrow:before {
  right: 50%;
  border-bottom: 20px solid #000;
  border-right: 20px solid transparent;
}
.arrow:after {
  left: 50%;
  border-bottom: 20px solid #000;
  border-left: 20px solid transparent;
}
Run Code Online (Sandbox Code Playgroud)
<div …
Run Code Online (Sandbox Code Playgroud)

html css svg css-shapes

16
推荐指数
2
解决办法
1062
查看次数

Unity DI 使用 PerRequestLifetimeManager 注入 DbContext


我有以下代码用 Unity 初始化实例:

IUnityContainer container = new UnityContainer();
container.RegisterType<DbContext, VotingSystemContext>(new PerRequestLifetimeManager(), new InjectionConstructor());
container.RegisterType(typeof(IGenericRepository<>), typeof(GenericRepository<>));
container.RegisterType<IUnitOfWork, UnitOfWork>(new PerRequestLifetimeManager());    
container.RegisterTypes(
    AllClasses.FromAssemblies(
        Assembly.GetAssembly(typeof(IUserService)),
        Assembly.GetAssembly(typeof(UserService))),
    WithMappings.FromMatchingInterface,
    WithName.Default, WithLifetime.PerResolve);
DependencyResolver.SetResolver(new Unity.Mvc4.UnityDependencyResolver(container));
GlobalConfiguration.Configuration.DependencyResolver = new Unity.WebApi.UnityDependencyResolver(container);
Run Code Online (Sandbox Code Playgroud)

我使用PerRequestLifetimeManager所以我遵循了MSDN上的建议并在上面的代码末尾添加了新行:

DynamicModuleUtility.RegisterModule(typeof(UnityPerRequestHttpModule));
Run Code Online (Sandbox Code Playgroud)

但是在我放置之后。当页面(仅静态 html)加载时,我将 ajax 请求发送到我的 WebApi 控制器,该控制器调用GenericReposirory Get()抛出错误的方法:The operation cannot be completed because the DbContext has been disposed.
没有这行代码一切正常,但没有设置它可能不会处理上下文。
我的UnitOfWork班级:

public class UnitOfWork : IUnitOfWork, IDisposable
{
   private readonly VotingSystemContext _context;
   private bool _disposed;

   //GenericRepository properties

   private void Dispose(bool …
Run Code Online (Sandbox Code Playgroud)

.net c# entity-framework unity-container

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

标签 统计

.net ×1

c# ×1

css ×1

css-shapes ×1

entity-framework ×1

html ×1

svg ×1

unity-container ×1