小编Gre*_*g B的帖子

AdventureWorks无法创建ado.net实体数据模型

我正在尝试使用microsoft的示例数据库AdventureWorks2008R2 ...当我尝试创建ADO.NET实体数据模型时,我收到此错误:

Unable to generate the model because of the following exception: 'The table 'C:\USERS\XXXX\DOCUMENTS\VISUAL STUDIO 2010\PROJECTS\ANOTHERWORKS\ANOTHERWORKS\APP_DATA\ADVENTUREWORKS2008R2_DATA.MDF.Production.Document' was referenced by a relationship, but was not found.'.
Loading metadata from the database took 00:00:06.2308687.
Generating the model took 00:00:04.5808698.
Added the connection string to the Web.Config file.
Successfully registered the assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the Web.Config file.
Writing the .edmx file took 00:00:00.0015898.
Run Code Online (Sandbox Code Playgroud)

有没有人遇到过这个问题?或者知道某个地方我可以下载这个数据库的工作版本(其他时间:http://msftdbprodsamples.codeplex.com/releases/view/59211这是我得到它的地方)

或者有人可以指向我可以下载并使用实体框架的示例数据库.

sql-server ado.net visual-studio-2010

7
推荐指数
1
解决办法
2278
查看次数

LINQ:有很多关系,请从列表中选择

我无法确定如何根据多对多关系中的列表进行选择.

我用entity-framework创建了以下实体和多对多关系(请纠正我,如果我这样做错了):

public class Foo {
  public int FooID { get; set; }
  public string FooName { get; set; }
  public virtual ICollection<FooBar> Foo_Bar { get; set; }
}

public class Bar {
  public int BarID { get; set; }
  public string BarName { get; set; }
  public virtual ICollection<FooBar> Foo_Bar { get; set; }
}

public class FooBar {
  public int FooBarID{ get; set; }
  public virtual int BarID { get; set; }
  public virtual int FooID { get; …
Run Code Online (Sandbox Code Playgroud)

linq asp.net entity-framework asp.net-mvc-3

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

HTML强制刷新

我刚刚完成了一个已经超过一年的网站的重新设计/重新设计.新的HTML,新的CSS,新的图像.

如何强制所有访问者刷新他们的缓存,以便他们不会试图查找去年的资产并获得破损的页面?

我已经阅读了有关META刷新的内容,但这似乎不是正确的解决方案.这是我唯一的选择吗?

html css asp.net-mvc-4

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

LINQ:搜索2个属性以获取字符串列表

我的代码的不同部分有以下内容:

QuestionModel:

public class QuestionModel {
    public string Question { get; set; }
    public string Answer { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

关键词:

List<string> SearchKeywords
Run Code Online (Sandbox Code Playgroud)

问题:

List<QuestionModel> Questions
Run Code Online (Sandbox Code Playgroud)

我想要实现的是从所有问题列表中搜索并保留所有具有所有关键字的问题.

我走了这么远,但遇到了一个障碍:

var questions = GetAllQuestions(); //returns all questions as a List<QuestionModel>
Questions = questions.All(x => SearchKeywords.All(k => x.Question.Contains(k) || x.Answer.Contains(k)));
Run Code Online (Sandbox Code Playgroud)

然而,这会返回一个bool.

任何帮助或指示将不胜感激.

c# linq asp.net-mvc-4

0
推荐指数
1
解决办法
72
查看次数