关于ADO.NET Entity Data Model的方法

a914642296 2010-11-22 01:24:46
dataEntities dataEntities db = new dataEntities();
public IQueryable<Dinner> FindDinnersByText(string q)
{
return db.Dinners.Where(d => d.Title.Contains(q) //这里d=> 是什么意思,d是这样不需要定义吗, 还有就是属性后面的 contains() 这个方法的具体用法说明,
|| d.Description.Contains(q)
|| d.HosttedBy.Contains(q));
}

看帮助有点看不懂 希望大家帮解释一下,
...全文
127 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
TIM178 2011-08-13
  • 打赏
  • 举报
回复
是的这个d定义的类??这个类我都没有发现耶,但是为什么可以使用呢?
sunlongchina 2010-11-22
  • 打赏
  • 举报
回复
d => d.Title.Contains(q) 就是比对
q107770540 2010-11-22
  • 打赏
  • 举报
回复
labmda表达式

contains翻译成sql 就是like的意思

你的语句你可以这样理解:
"select * from Dinners where title like '%"+ q +"%' or Description like '%"+q+"%'" ...
a914642296 2010-11-22
  • 打赏
  • 举报
回复
其实我就想问那个 d
A comprehensive guide to the Entity Framework with insight into its latest features and optimizations for responsive data access in your projects About This Book Create Entity data models from your database and use them in your applications Learn about the Entity Client data provider and write statements in Entity SQL to perform CRUD operations Explore ADO.NET Data Services and how they work with the Entity Framework Who This Book Is For If you are a C# developer who wants to learn a new way of querying data and utilizing it in applications efficiently for data binding or other operations, then this book is for you. Basic knowledge of ADO.NET is assumed. What You Will Learn Explore the features of the ADO.NET Entity Framework Understand the concepts of entities and their relationships Create an Entity Data Model using the ADO.NET Entity Data Model Designer and the EdmGen tool Extend existing Entity Types to create your own Entity Types Write programs against the Entity Data Model to perform CRUD operations Discover ADO.NET Data Services and learn how they can be used with the Entity Framework Familiarize yourself with WCF Data Services (formerly ADO.NET Data Services) Apply Code First, Model First and Database First approaches In Detail The ADO.NET Entity Framework from Microsoft is a new ADO.NET development framework that provides a level of abstraction for data access strategies and solves the impedance mismatch issues that exist between different data models. This book explores Microsoft's Entity Framework and explains how it can used to build enterprise level applications. It will also teach you how you can work with RESTful Services and Google's Protocol Buffers with Entity Framework and WCF. You will explore how to use Entity Framework with ASP.NET Web API and also how to consume the data exposed by Entity Framework from client applications of varying types, i.e., ASP.NET MVC, WPF and Silverlight. You will familiarize yourself with the new features and improvements introduced in Entity Framework including enhanced POCO support, template-based code generation, tooling consolidation and connection resiliency. By the end of the book, you will be able to successfully extend the new functionalities of Entity framework into your project. Style and approach This book is a step-by-step tutorial providing hands-on code examples with detailed explanations. The book aims to explain the concepts of the Entity Framework and illustrate how you can use these in applications with a tutorial based approach. Table of Contents Chapter 1: Introducing the ADO.NET Entity Framework Chapter 2: Getting Started Chapter 3: Entities, Relationships, and the Entity Data Model Chapter 4: Working with Stored Procedures in the Entity Data Model Chapter 5: Working with Entity Client and Entity SQL Chapter 6: Working with LINQ to Entities Chapter 7: Working with the Object Services Layer Chapter 8: Working with WCF Data Services Appendix: Advanced Concepts

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧