作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
<分区>
我正在尝试创建通用 Repository pattern
基类,从中实现成员。这是一个代码:
public abstract class RepositoryBase<TEntity, TType> : IRepository<TEntity, TType>
where TEntity : EntityBase<TType>
{
public IAdNetMsSqlContext Context { get; set; }
public DbSet<TEntity> DbSet { get; set; }
public RepositoryBase(IAdNetMsSqlContext context)
{
Context = context;
DbSet = context.Set<TEntity>();
}
public IQueryable<TEntity> Get(TType id)
{
//!!! Here is an error
return DbSet.FirstOrDefault(e => e.Id == id);
}
....
}
我得到了错误:
Error 1 Operator '==' cannot be applied to operands of type 'TType' and `'TType' .... AdNet.Common.Base
行内:
return DbSet.FirstOrDefault(e => e.Id == id);
我不知道该怎么想。 TType 肯定等于 TType。
感谢任何预付款!
问题是使用 检查序列是否为回文Brainfuck . 输入 是一串数字 输出 如果不是回文,则为 0,否则为 1。 我有一个想法: 假设,我们有序列 1 2 3 2 1。我们可以在变量中记住数组中的第
今天晚上下班回来才有空看群,群友发了一条很简单的慢SQL问怎么优化。 非常简单,我自己模拟的数据。 表结构: -- auto-generated definition CREATE TAB
我是一名优秀的程序员,十分优秀!