小编Dim*_*ngo的帖子

无法加载文件或程序集'DotNetOpenAuth.Core

当我启动我的asp net mvc 4应用程序时出现以下错误:

Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, 
Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. 
The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

这是错误日志

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Windows\SysWOW64\inetsrv\w3wp.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: User = notebook\Guilherme
LOG: DisplayName = DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
 (Fully-specified)
LOG: Appbase = file:///C:/Users/Guilherme/Documents/Visual Studio 2012/Projects/Gedi/Gedi/
LOG: Initial PrivatePath = C:\Users\Guilherme\Documents\Visual Studio 2012\Projects\Gedi\Gedi\bin
Calling assembly : Microsoft.Web.WebPages.OAuth, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
=== …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net asp.net-mvc asp.net-mvc-4

82
推荐指数
5
解决办法
10万
查看次数

区别于不使用LINQ

我想使用distinct从LIST中删除重复的行.

这是结果集(如您所见,重复索引12和14)

id  idIndice    idName         idTipo   tamanho     caminho
12  11          Processo       3        10          C:\Program Files\Empenho\Senha.txt
13  13          Endereço       1        250         C:\Program Files\Empenho\Senha.txt
14  12          Número         2        5           C:\Program Files\Empenho\Senha.txt
15  9           Cep            5        8           C:\Program Files\Empenho\Senha.txt 
16  10          Dt. de Nasc.   4        0           C:\Program Files\Empenho\Senha.txt
12  11          Processo       3        10          C:\Program Files\Empenho\Senha.txt
14  12          Número         2        5           C:\Program Files\Empenho\Senha.txt
Run Code Online (Sandbox Code Playgroud)

这是我想要的sql(这样做)

select DISTINCT u.id, u.idIndice, t.idName, t.idTipo, t.tamanho, l.caminho
from  tgpwebged.dbo.sistema_Indexacao as u
join  tgpwebged.dbo.sistema_Indexes as t …
Run Code Online (Sandbox Code Playgroud)

c# linq

12
推荐指数
3
解决办法
7346
查看次数

获取sql server中最后插入的行,该行具有id作为主键并且是标识

我已经尝试了几种方式的linq查询来检索插入sql server表中的最后一行.

我需要这样的somenthing

var lastId = from u in context.sistema_Documentos where u.id == max select u;
Run Code Online (Sandbox Code Playgroud)

有些人说这是不可能的,有些人说它不安全或影响性能.我怎么能执行这个查询?

Ps ..这将是一个很好的方法吗?

var lastId = from u in context.sistema_Documentos orderby u.id descending select u.id;
Run Code Online (Sandbox Code Playgroud)

c# linq asp.net asp.net-mvc asp.net-mvc-4

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

System.ArgumentException:System.Linq.Expressions方法中为lambda声明提供的参数数量不正确

Mates,我正在尝试使用System.Linq.Expressions构建表达式树,我收到此错误:

Erro:System.ArgumentException:1 parameters) at System.Linq.Expressions.Expression.Lambda[TDelegate](Expression body, String name, Boolean tailCall, IEnumerableSystem.Linq.Expressions.Expression.Lambda [TDelegate](表达式)System.Linq.Expressions.Expression.ValidateLambdaArgs(类型delegateType,Expression&body,ReadOnlyCollection 1参数)中为lambda声明提供的参数数量不正确在System.Linq.Expressions.Expression.Lambda [TDelegate](表达式体,ParameterExpression []参数)的body,Boolean tailCall,IEnumerable`1参数)在C:\ Users \中的Gedi.Controllers.OperacaoController.opBuscaFile(FormCollection表单) Guilherme\Documents\Visual Studio 2012\Projects\Gedi\Gedi\Controllers\OperacaoController.cs:338行

代码:

IQueryable<String> queryableData = AllIndexValues.AsQueryable<string>();


//docTypeId == idTipo
ParameterExpression pe1 = Expression.Parameter(typeof(int), "docTypeId");
Expression right = Expression.Constant(idTipo);
Expression e1 = Expression.Equal(pe1, right);


//idIndice == 16
ParameterExpression pe2 = Expression.Parameter(typeof(int), "idIndice");
right = Expression.Constant(16, typeof(int));
Expression e2 = Expression.Equal(pe2, right);

//docTypeId == idTipo AND idIndice == 16
Expression predicateBody = Expression.And(e1,e2);

//queryableData.Where(docTypeId => (docTypeId ==  idTipo) AND idIndice …
Run Code Online (Sandbox Code Playgroud)

.net c# linq expression-trees linq-to-sql

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