SlideShare a Scribd company logo
1 of 42
SharePoint, LINQ иOpen Data Protocol Vitaly Baum Senior SharePoint Developer @ Conteq  Активный участник групп разработчиков в Санкт-Петербурге и Москве, подкастер и блоггер http://butaji.ru
План выступления LINQ to SharePoint 2010 Open Data Protocol
LINQ to SharePoint
Преимущества LINQ Строгая типизация Запросы к реляционным данным в строго-типизированной форме Компилятор проверит ошибки в запросах IntelliSense Унифицированный путь получения данных из любого источника
LINQ to SharePoint SPMetal Генерирует DataContext SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.cs 
LINQ to SharePoint Недостатки Преобразуется в CAML Не все операторы реализованы Двухэтапные запросы Аггрегирующие запросы SPSiteDataQuery
Mapping internal partial class OrganisationSiteDataContext     : Microsoft.SharePoint.Linq.DataContext{} [ContentType(Name = "Employee")] public partial class Employee {     [Column(Name="ID", IsId=true, ReadOnly=true, FieldType="Counter")]     public int Id {get; set;} }
ICostumMapping public partial class Project : ICustomMapping {    [CustomMapping(Columns = new String[] { «Due_x0020_Date», «IsCancelled» })]    public void MapFrom(object listItem)    {         this.DueDate= ((SPListItem)listItem)[“Due_x0020_Date”];        this.IsCancelled = ((SPListItem)listItem)[“IsCancelled”];    }    public void MapTo(object listItem)    {        ((SPListItem)listItem)[“Due_x0020_Date”] = this.DueDate;       ((SPListItem)listItem)[“IsCancelled”] = this.IsCancelled;    }     public void Resolve(RefreshMode mode, object originalListItem, object databaseObject) {    } }
SPMetal ImtechSPMetalDefinition Extension
LINQ to SharePoint Демо
Open Data Protocol Открытый доступ к данным Открытыеформаты данных Унифицированная форма запросов
Open Data Protocol Открытый доступ к данным HTTP Открытыеформаты данных AtomPub, JSON Унифицированная форма запросов LINQ
Open Data Protocol Уровень абстракции Широкого доступа Унифицированного доступа Простого доступа
Open Data Protocol Потребители Браузеры OData Explorer Excel 2010 (PowerPivot) LinQPad Visual Studio …
Open Data Protocol http://services.odata.org/OData/OData.svc/ <service xml:base="http://services.odata.org/OData/OData.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">    <workspace>      <atom:title>Default</atom:title>      <collection href="Products">        <atom:title>Products</atom:title>      </collection>      <collection href="Categories">        <atom:title>Categories</atom:title>      </collection>      <collection href="Suppliers">        <atom:title>Suppliers</atom:title>      </collection>    </workspace>  </service>
Open Data Protocol http://services.odata.org/OData/OData.svc/Products <?xml version="1.0" encoding="windows-1251" standalone="yes"?> <feed xml:base="http://services.odata.org/OData/OData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">   <title type="text">Products</title>   <id>http://services.odata.org/OData/OData.svc/Products</id>   <updated>2010-07-01T20:01:57Z</updated>   <link rel="self" title="Products" href="Products" />   <entry>     <id>http://services.odata.org/OData/OData.svc/Products(0)</id>     <title type="text">Bread</title>     <summary type="text">Whole grain bread</summary>     <updated>2010-07-01T20:01:57Z</updated>     <author>       <name />     </author>…
Open Data Protocol http://services.odata.org/OData/OData.svc/Products(4) <?xml version="1.0" encoding="windows-1251" standalone="yes"?> <entry xml:base="http://services.odata.org/OData/OData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">   <id>http://services.odata.org/OData/OData.svc/Products(4)</id>   <title type="text">Fruit Punch</title>   <summary type="text">Mango flavor, 8.3 Ounce Cans (Pack of 24)</summary>   <updated>2010-07-01T20:03:37Z</updated>   <author>     <name />   </author>   <link rel="edit" title="Product" href="Products(4)" />   <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(4)/Category" />   <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(4)/Supplier" />   <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />   <content type="application/xml">     <m:properties>       <d:ID m:type="Edm.Int32">4</d:ID>       <d:ReleaseDate m:type="Edm.DateTime">2003-01-05T00:00:00</d:ReleaseDate>       <d:DiscontinuedDate m:type="Edm.DateTime" m:null="true" />       <d:Rating m:type="Edm.Int32">3</d:Rating>       <d:Price m:type="Edm.Decimal">22.99</d:Price>     </m:properties>   </content> </entry>
Open Data Protocol Типы данных Null Binary Boolean Byte DateTime Decimal Double Single Guid Int16, Int32, Int64 Sbyte String Time DateTimeOffset
Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Products <feed xml:base="http://localhost:8080/owind.svc/" ...>   ...   <entry>   ...   <link rel="edit" title="Product" href="Products(3)" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category"     type="application/atom+xml;type=entry" title="Category" href="Products(3)/Category" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details"     type="application/atom+xml;type=feed" title="Order_Details" href="Products(3)/Order_Details" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier"     type="application/atom+xml;type=entry" title="Supplier" href="Products(3)/Supplier" />    ...   <content type="application/xml">     <m:properties>       <d:ProductID m:type="Edm.Int32">3</d:ProductID>        <d:ProductName>Aniseed Syrup</d:ProductName>        ...     </m:properties>   </content>   </entry>   ... </feed>
Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Products <feed xml:base="http://localhost:8080/owind.svc/" ...>   ...   <entry>   ...   <link rel="edit" title="Product" href="Products(3)" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category"     type="application/atom+xml;type=entry" title="Category" href="Products(3)/Category" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details"     type="application/atom+xml;type=feed" title="Order_Details" href="Products(3)/Order_Details" />    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier"     type="application/atom+xml;type=entry" title="Supplier" href="Products(3)/Supplier" />    ...   <content type="application/xml">     <m:properties>       <d:ProductID m:type="Edm.Int32">3</d:ProductID>        <d:ProductName>Aniseed Syrup</d:ProductName>        ...     </m:properties>   </content>   </entry>   ... </feed>
Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Description <Description xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> Sweet and savory sauces, relishes, spreads, and seasonings </Description>
Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Description/$value Sweet and savory sauces, relishes, spreads, and seasonings
Open Data Protocol http://localhost:8080/owind.svc/Categories/$count 8
Open Data Protocol http://localhost:53211/owind.svc/Categories(4)/$links/Products <links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> <uri>http://localhost:53211/owind.svc/Products(11)</uri> <uri>http://localhost:53211/owind.svc/Products(12)</uri> <uri>http://localhost:53211/owind.svc/Products(31)</uri> <uri>http://localhost:53211/owind.svc/Products(32)</uri> <uri>http://localhost:53211/owind.svc/Products(33)</uri> <uri>http://localhost:53211/owind.svc/Products(59)</uri> <uri>http://localhost:53211/owind.svc/Products(60)</uri> <uri>http://localhost:53211/owind.svc/Products(69)</uri> <uri>http://localhost:53211/owind.svc/Products(71)</uri> <uri>http://localhost:53211/owind.svc/Products(72)</uri> </links>
Open Data Protocol http://localhost:8080/owind.svc/Categories?$orderby=CategoryName desc&$top=4 http://localhost:53211/owind.svc/Categories?$filter=(CategoryID add 4) eq8 http://localhost:53211/owind.svc/Categories?$filter=startswith(CategoryName, 'Sea')
Open Data Protocol <html> <head>     <title>OData JSON Test</title>     <script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script> </head> <body>     <script type="text/javascript">         $(document).ready(function () {             $("#foo").text("fetching..."); varurl = "http://localhost:8080/owind.svc/Categories/";             $.getJSON(url, function (result) {               $("#foo").text(result.d[0].CategoryName);             });         });     </script>     <p id="foo">loading page...</p> </body> </html>
Open Data Protocol Объявлять функции Выдавать данные в JSON Наслаждаться жизнью
Open Data Protocol Поставщики SharePoint 2010 IBM WebSphere SQL Azure Azure Table Storage SQL Reporting Services …
Open Data Protocol Поставщики Facebook Netflix Pluralsight Stack Overflow Codename Dallas …
Browser, Visual Studio, Python Демо
Готовим OData
Готовим OData Парочка IQueryable<T> ADO.NET Data Services v1.5 Немного желания
Готовим ODataEntity Framework, LINQ to SQL public class ProductService : DataService<ProductEntities> { public static void InitializeService(DataServiceConfigurationconfig) { // Give readonly access to all of the entities config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); // Pagesize will change the max number of rows returned config.SetEntitySetPageSize("*", 25); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } }
Готовим ODataReflection Provider public class MyDataSource {      public IQueryable<Product> Products { get {…} }      public IQueryable<Categories> Categories { get {…} }  } public class MyDataSourceService: DataService<MyDataSource> { … }
Готовим OData Демо
OData в SharePoint
SharePoint OData Content database SharePoint Data SharePoint LINQ to SharePoint ListData.svc Atom JSON Post, Put, Get Client Application Любая платформа  .NET, Java, Flash, Silverlight
SharePoint OData Операции и HTTP действия Получение данных GET Создание записи POST Изменение записи PUT илиMERGE Удаление записи DELETE И всё это действует на ссылки Все политики SharePoint работают Валидация, Контроль доступа и т.д.
OData в SharePoint Демо
Vitaly Baum http://butaji.ru vbaum@live.com
Ресурсы http://sharepoint.microsoft.com/ http://odata.org http://msdn.microsoft.com/en-us/library/ff478141.aspx http://blogs.msdn.com/b/alexj/archive/2010/01/07/data-service-providers-getting-started.aspx

More Related Content

Featured

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Featured (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

SharePoint, LINQ, OData

  • 1. SharePoint, LINQ иOpen Data Protocol Vitaly Baum Senior SharePoint Developer @ Conteq Активный участник групп разработчиков в Санкт-Петербурге и Москве, подкастер и блоггер http://butaji.ru
  • 2. План выступления LINQ to SharePoint 2010 Open Data Protocol
  • 4. Преимущества LINQ Строгая типизация Запросы к реляционным данным в строго-типизированной форме Компилятор проверит ошибки в запросах IntelliSense Унифицированный путь получения данных из любого источника
  • 5. LINQ to SharePoint SPMetal Генерирует DataContext SPMetal /web:http://ContosoServer/Marketing /code:MarketingSite.cs 
  • 6. LINQ to SharePoint Недостатки Преобразуется в CAML Не все операторы реализованы Двухэтапные запросы Аггрегирующие запросы SPSiteDataQuery
  • 7. Mapping internal partial class OrganisationSiteDataContext : Microsoft.SharePoint.Linq.DataContext{} [ContentType(Name = "Employee")] public partial class Employee { [Column(Name="ID", IsId=true, ReadOnly=true, FieldType="Counter")] public int Id {get; set;} }
  • 8. ICostumMapping public partial class Project : ICustomMapping { [CustomMapping(Columns = new String[] { «Due_x0020_Date», «IsCancelled» })] public void MapFrom(object listItem) { this.DueDate= ((SPListItem)listItem)[“Due_x0020_Date”]; this.IsCancelled = ((SPListItem)listItem)[“IsCancelled”]; } public void MapTo(object listItem) { ((SPListItem)listItem)[“Due_x0020_Date”] = this.DueDate; ((SPListItem)listItem)[“IsCancelled”] = this.IsCancelled; } public void Resolve(RefreshMode mode, object originalListItem, object databaseObject) { } }
  • 10. LINQ to SharePoint Демо
  • 11.
  • 12. Open Data Protocol Открытый доступ к данным Открытыеформаты данных Унифицированная форма запросов
  • 13. Open Data Protocol Открытый доступ к данным HTTP Открытыеформаты данных AtomPub, JSON Унифицированная форма запросов LINQ
  • 14. Open Data Protocol Уровень абстракции Широкого доступа Унифицированного доступа Простого доступа
  • 15. Open Data Protocol Потребители Браузеры OData Explorer Excel 2010 (PowerPivot) LinQPad Visual Studio …
  • 16. Open Data Protocol http://services.odata.org/OData/OData.svc/ <service xml:base="http://services.odata.org/OData/OData.svc/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app"> <workspace> <atom:title>Default</atom:title> <collection href="Products"> <atom:title>Products</atom:title> </collection> <collection href="Categories"> <atom:title>Categories</atom:title> </collection> <collection href="Suppliers"> <atom:title>Suppliers</atom:title> </collection> </workspace> </service>
  • 17. Open Data Protocol http://services.odata.org/OData/OData.svc/Products <?xml version="1.0" encoding="windows-1251" standalone="yes"?> <feed xml:base="http://services.odata.org/OData/OData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <title type="text">Products</title> <id>http://services.odata.org/OData/OData.svc/Products</id> <updated>2010-07-01T20:01:57Z</updated> <link rel="self" title="Products" href="Products" /> <entry> <id>http://services.odata.org/OData/OData.svc/Products(0)</id> <title type="text">Bread</title> <summary type="text">Whole grain bread</summary> <updated>2010-07-01T20:01:57Z</updated> <author> <name /> </author>…
  • 18. Open Data Protocol http://services.odata.org/OData/OData.svc/Products(4) <?xml version="1.0" encoding="windows-1251" standalone="yes"?> <entry xml:base="http://services.odata.org/OData/OData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"> <id>http://services.odata.org/OData/OData.svc/Products(4)</id> <title type="text">Fruit Punch</title> <summary type="text">Mango flavor, 8.3 Ounce Cans (Pack of 24)</summary> <updated>2010-07-01T20:03:37Z</updated> <author> <name /> </author> <link rel="edit" title="Product" href="Products(4)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(4)/Category" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(4)/Supplier" /> <category term="ODataDemo.Product" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /> <content type="application/xml"> <m:properties> <d:ID m:type="Edm.Int32">4</d:ID> <d:ReleaseDate m:type="Edm.DateTime">2003-01-05T00:00:00</d:ReleaseDate> <d:DiscontinuedDate m:type="Edm.DateTime" m:null="true" /> <d:Rating m:type="Edm.Int32">3</d:Rating> <d:Price m:type="Edm.Decimal">22.99</d:Price> </m:properties> </content> </entry>
  • 19. Open Data Protocol Типы данных Null Binary Boolean Byte DateTime Decimal Double Single Guid Int16, Int32, Int64 Sbyte String Time DateTimeOffset
  • 20. Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Products <feed xml:base="http://localhost:8080/owind.svc/" ...> ... <entry> ... <link rel="edit" title="Product" href="Products(3)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(3)/Category" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Products(3)/Order_Details" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(3)/Supplier" /> ... <content type="application/xml"> <m:properties> <d:ProductID m:type="Edm.Int32">3</d:ProductID> <d:ProductName>Aniseed Syrup</d:ProductName> ... </m:properties> </content> </entry> ... </feed>
  • 21. Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Products <feed xml:base="http://localhost:8080/owind.svc/" ...> ... <entry> ... <link rel="edit" title="Product" href="Products(3)" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Category" type="application/atom+xml;type=entry" title="Category" href="Products(3)/Category" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Products(3)/Order_Details" /> <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Supplier" type="application/atom+xml;type=entry" title="Supplier" href="Products(3)/Supplier" /> ... <content type="application/xml"> <m:properties> <d:ProductID m:type="Edm.Int32">3</d:ProductID> <d:ProductName>Aniseed Syrup</d:ProductName> ... </m:properties> </content> </entry> ... </feed>
  • 22. Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Description <Description xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> Sweet and savory sauces, relishes, spreads, and seasonings </Description>
  • 23. Open Data Protocol http://localhost:8080/owind.svc/Categories(2)/Description/$value Sweet and savory sauces, relishes, spreads, and seasonings
  • 24. Open Data Protocol http://localhost:8080/owind.svc/Categories/$count 8
  • 25. Open Data Protocol http://localhost:53211/owind.svc/Categories(4)/$links/Products <links xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices"> <uri>http://localhost:53211/owind.svc/Products(11)</uri> <uri>http://localhost:53211/owind.svc/Products(12)</uri> <uri>http://localhost:53211/owind.svc/Products(31)</uri> <uri>http://localhost:53211/owind.svc/Products(32)</uri> <uri>http://localhost:53211/owind.svc/Products(33)</uri> <uri>http://localhost:53211/owind.svc/Products(59)</uri> <uri>http://localhost:53211/owind.svc/Products(60)</uri> <uri>http://localhost:53211/owind.svc/Products(69)</uri> <uri>http://localhost:53211/owind.svc/Products(71)</uri> <uri>http://localhost:53211/owind.svc/Products(72)</uri> </links>
  • 26. Open Data Protocol http://localhost:8080/owind.svc/Categories?$orderby=CategoryName desc&$top=4 http://localhost:53211/owind.svc/Categories?$filter=(CategoryID add 4) eq8 http://localhost:53211/owind.svc/Categories?$filter=startswith(CategoryName, 'Sea')
  • 27. Open Data Protocol <html> <head> <title>OData JSON Test</title> <script src="/Scripts/jquery-1.3.2.js" type="text/javascript"></script> </head> <body> <script type="text/javascript"> $(document).ready(function () { $("#foo").text("fetching..."); varurl = "http://localhost:8080/owind.svc/Categories/"; $.getJSON(url, function (result) { $("#foo").text(result.d[0].CategoryName); }); }); </script> <p id="foo">loading page...</p> </body> </html>
  • 28. Open Data Protocol Объявлять функции Выдавать данные в JSON Наслаждаться жизнью
  • 29. Open Data Protocol Поставщики SharePoint 2010 IBM WebSphere SQL Azure Azure Table Storage SQL Reporting Services …
  • 30. Open Data Protocol Поставщики Facebook Netflix Pluralsight Stack Overflow Codename Dallas …
  • 31. Browser, Visual Studio, Python Демо
  • 33. Готовим OData Парочка IQueryable<T> ADO.NET Data Services v1.5 Немного желания
  • 34. Готовим ODataEntity Framework, LINQ to SQL public class ProductService : DataService<ProductEntities> { public static void InitializeService(DataServiceConfigurationconfig) { // Give readonly access to all of the entities config.SetEntitySetAccessRule("*", EntitySetRights.AllRead); // Pagesize will change the max number of rows returned config.SetEntitySetPageSize("*", 25); config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; } }
  • 35. Готовим ODataReflection Provider public class MyDataSource { public IQueryable<Product> Products { get {…} } public IQueryable<Categories> Categories { get {…} } } public class MyDataSourceService: DataService<MyDataSource> { … }
  • 38. SharePoint OData Content database SharePoint Data SharePoint LINQ to SharePoint ListData.svc Atom JSON Post, Put, Get Client Application Любая платформа .NET, Java, Flash, Silverlight
  • 39. SharePoint OData Операции и HTTP действия Получение данных GET Создание записи POST Изменение записи PUT илиMERGE Удаление записи DELETE И всё это действует на ссылки Все политики SharePoint работают Валидация, Контроль доступа и т.д.
  • 42. Ресурсы http://sharepoint.microsoft.com/ http://odata.org http://msdn.microsoft.com/en-us/library/ff478141.aspx http://blogs.msdn.com/b/alexj/archive/2010/01/07/data-service-providers-getting-started.aspx