Comparacao Estrategica sobre as Tecnologias de Acesso a Dados da Microsoft

2,005 views

Published on

Devido às recentes inovações da Microsoft, incluindo, LINQ, Entity Framework e ADO.NET Data Services, escolhe uma tecnologia de acesso a dados tornou-se um debate. A escolha precisa atender aos atributos de produtividade, elegância e desepenho. Podemos levantar algumas questões tais como: podemos continuar a usar data readers e datasets? Como escolher entre LINQ e Entity Framework? Devo desenhar os meus próprios tipos ou usar tipos vindo de um schema do banco de dados? Como expor o meu modelo através de um serviço WCF? Esta sessão apresenta o uso de cada uma das tecnologias de acesso a dados, discutindo prós-contras e ajudando a entender a usar a ferramenta certa no lugar certo.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,005
On SlideShare
0
From Embeds
0
Number of Embeds
148
Actions
Shares
0
Downloads
20
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Criar empatia com a audência sobre qual tecnologia a escolher
  • Falar sobre as várias tecnologias existentes em cada local Após a animação ressaltar sobre os aspectos de cada componente
  • Microsoft ASP.NET Connections Updates will be available at http://www.devconnections.com/updates/Orlando_Spring09/ASP
  • Microsoft ASP.NET Connections Updates will be available at http://www.devconnections.com/updates/Orlando_Spring09/ASP
  • Microsoft ASP.NET Connections Updates will be available at http://www.devconnections.com/updates/Orlando_Spring09/ASP
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • http://www.idesign.net ©2007 Michele Leroux Bustamante, IDesign Inc. All rights reserved 09/12/09 01:19 ©2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. Falar sobre a conexão com o LINQ Enabled ADO.NET
  • Falando espeficicamente do Linq To SQL .... <abre a animação>
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • Dá enfase em Linq to Entities e Entity SQL
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • Microsoft ASP.NET Connections Updates will be available at http://www.devconnections.com/updates/Orlando_Spring09/ASP
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. If you would like to host your demo on the Virtual Server, please use the myVPC demo slide, not this slide.
  • 09/12/09 01:19 © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
  • Comparacao Estrategica sobre as Tecnologias de Acesso a Dados da Microsoft

    1. 2. Uma comparação estratégica sobre as tecnologias de acesso a dados Luciano Condé Arquiteto de Soluções Microsoft Brasil http://blogs.msdn.com/conde http ://twitter.com/luconde Código da Sessão: DAT201
    2. 5. As tecnologias ADO.NET Linq To Sql ADO.NET Data Services Entity Framework
    3. 6. ADO.Net 1.x
    4. 7. ADO.NET 1.x - Arquitetura Managed Data Provider IDbConnection IDbCommand DataSet Cliente Cliente IDbDataAdapter IDataReader
    5. 8. ADO.Net Dataset <ul><li>Suporta binding, caching, offline, change tracking e CRUD </li></ul><ul><li>As entidades podem ser codificadas como datasets tipados </li></ul><ul><li>Suporta múltiplos providers de dados </li></ul><ul><li>Suporta ações CRUD (views, procs e tables) </li></ul><ul><li>Suporta transação, concorrência, procs, views </li></ul>
    6. 9. DataSet – Cenários <ul><li>DAL </li></ul><ul><ul><li>CRUD com poucas operações </li></ul></ul><ul><ul><li>Gera dataset tipado </li></ul></ul>Service Business Components Data Access SQL ADO.Net Entities Mapping Data Contracts / Serializable Data Access Layer with DataSet
    7. 10. DataSet - Cenários <ul><li>ASP.NET </li></ul><ul><ul><li>Use o ObjectDataSource </li></ul></ul><ul><ul><li>Precisa de camada de serviço/proxy para transporte </li></ul></ul>Data Access SQL Browser ASP.NET ObjectDataSource DataSet Service ASP.NET DataSet Binding
    8. 11. DataSet - Cenários <ul><li>Windows Forms e WPF applications </li></ul><ul><ul><li>Controles usam a fonte de dado diretamente </li></ul></ul><ul><ul><li>Experiência offline </li></ul></ul>Service Business Components Data Access SQL Client F/S DataSet DataSet Binding e Working Offline
    9. 12. Cenário Dataset ADO.NET Regras e componentes de negócios Datasets DataAdapter TechedDemo01ADONETBLL TechedDemo01ADONETService TechedDemo01ADONETPresent TechedDemo01ADONETDAL MVC WCF DLL DLL Entidades
    10. 13. Cenário ADO.Net Dataset
    11. 14. LINQ To SQL
    12. 15. LINQ ( L anguage IN tegrated Q uery) Trás para a OO a capacidade de realizar consultas (queries) sobre coleção de dados
    13. 16. LINQ - Arquitetura Objetos <book> <title/> <author/> <price/> </book> XML Relacional LINQ To Objects LINQ To XML LINQ To Entities LINQ To SQL LINQ To DataSet .NET Language Integrated Query (LINQ) Linguagem de programação LINQ enabled data sources LINQ enabled ADO.NET
    14. 17. Exemplo sem LINQ
    15. 18. Exemplo com LINQ LINQ Query
    16. 19. LINQ To SQL - Arquitetura
    17. 20. Criando uma app LINQ To SQL
    18. 21. Linq To Sql <ul><li>Suporta CRUD, binding </li></ul><ul><li>O código das entidades é baseado no esquema do banco de dado </li></ul><ul><li>Limitado ao mapeamento entre o modelo de entidades e o banco de dados. </li></ul><ul><li>Suporta transação, concorrência, procs, views </li></ul><ul><li>Não tem modelo de providers </li></ul>
    19. 22. LINQ to SQL - Cenários <ul><li>BLL </li></ul><ul><ul><li>As queries LINQ podem ser feitas diretamente com LINQ Context </li></ul></ul>Service Business Components SQL LINQ DataContext Data Contracts / Serializable LINQ Entities BLL com LINQ to SQL
    20. 23. LINQ to SQL – Cenários <ul><li>DAL </li></ul><ul><ul><li>As queries LINQ podem ser feitas diretamente com LINQ Context </li></ul></ul>Service Business Components SQL Data Contracts / Serializable LINQ Entities Data Access LINQ DataContext DAL com LINQ to SQL
    21. 24. Cenário Linq To SQL LINQ To Sql Regras e componentes de negócios Linq Entities Linq DataContext TechedDemo02LinqToSQLBLL TechedDemo01ADONETService TechedDemo03ADONeDSWebPresent MVC WCF DLL Entidades
    22. 25. Cenário LINQ To SQL
    23. 26. Entity Framework
    24. 27. Entity Framework <ul><li>Um ORM que separa o modelo conceitual do físico </li></ul><ul><li>Permite a programação OO sobre as entidades – herança </li></ul><ul><li>EF “como” um DAL </li></ul><ul><li>Feito para ser multi-banco </li></ul><ul><li>Suporta ações CRUD (views, procs e tables) </li></ul><ul><li>Vários providers disponíveis </li></ul><ul><ul><li>SQL Server, Oracle, Mysql, DB2… </li></ul></ul><ul><li>Suporta transação, concorrência, procs, views </li></ul><ul><li>Disponível a partir da .NET Framework 3.5 SP1 </li></ul>
    25. 28. Arquitetura
    26. 29. Entity Framework
    27. 30. Entity Framework - Cenários <ul><li>BLL </li></ul><ul><ul><li>As queries LINQ podem ser feitas diretamente com ObjectContext </li></ul></ul><ul><li>DAL </li></ul><ul><ul><li>As queries LINQ podem ser feitas diretamente com ObjectContext </li></ul></ul>Service Business Components Data Access SQL Mapping EF ObjectContext Data Contracts / Serializable Mapping Rules EF Entities DAL com Entity Framework
    28. 31. Entity Framework - Cenários <ul><li>ASP.NET </li></ul><ul><ul><li>Pode usar o EntityDataSource ou ObjectDataSource </li></ul></ul><ul><ul><li>EntityDataSource facilita o trabalho, por exemplo: </li></ul></ul><ul><ul><ul><li>Foreign key </li></ul></ul></ul>EF ObjectContext SQL Browser ASP.NET EntityDataSource Mapping Mapping Rules EF Entities ASP.NET Data Binding
    29. 32. Cenário Entity Framework EF Regras e componentes de negócios EF Entities EF Datacontext TechedDemo03ADONetEFBLL TechedDemo03ADONetEFService TechedDemo03ADONetEFPresent TechedDemo03ADONetEFLibrary MVC WCF DLL DLL Entidades
    30. 33. Cenário Entity Framework
    31. 34. Entity Framework v2 <ul><li>Novos recursos </li></ul><ul><ul><li>POCO </li></ul></ul><ul><ul><li>Model first </li></ul></ul><ul><ul><li>Lazy loading </li></ul></ul><ul><ul><li>Customizar a geração de código (T4) </li></ul></ul><ul><ul><li>Melhorias em TDD </li></ul></ul><ul><li>Disponível no Beta 1 do .NET Framework 4 </li></ul>
    32. 35. Suporte ORM – Linq To Sql X EF Linq To Sql X EF Funcionalidades Linq To Sql EF POCO/PI Sim, se converter para List<T> V1 = Não V2 = Sim Lazy Loading Sim, se não converter para List<T> V1= Call Load() V2 = DeferredLoadingEnabled Earger Loading Sim (no nível do contexto) Sim (no nível da query) Concorrência Otimista Otimista Mapeamento da Tabela via mapping Não Sim Mapeamento de Foreing Key Sim, via EntitySet<T> e EntityRef<T> V1 = Independent Associations V2 = Independent ou FK Associations
    33. 36. ADO.NET Data Services
    34. 37. ADO.Net data services Conjunto de bibliotecas e padrões que expõem dados como serviços, através de uma interface REST (http).
    35. 38. Criando ADO.NET Data Services
    36. 39. ADO.NET Data Services - Cenário ADO.NET Data Service SQL Server LINQ DataContext LINQ Entities REST ADO.NET Data Service SQL Server (OR other) EF ObjectContext EF Entities REST Browser Browser AJAX Silverlight Windows Forms / WPF Client
    37. 40. Cenário ADO.Net Data Services ADO.NET Data Services TechedDemo03ADONeDSDAL TechedDemo01ADONETPresent MVC Web Applicati-on LINQ to SQL ou EF Entidades
    38. 41. Cenário ADO.Net Data Services
    39. 42. ADO.Net Data Services V1.5 <ul><li>Novos recursos </li></ul><ul><ul><li>Rowcount </li></ul></ul><ul><ul><li>Feed customization </li></ul></ul><ul><ul><li>BLOBs </li></ul></ul><ul><ul><li>Binding direto com controles </li></ul></ul><ul><ul><li>Paginação via servidor </li></ul></ul><ul><li>CTP1 – já disponível hoje </li></ul>
    40. 43. Resumo <ul><li>Use ADO.NET em aplicações legadas – Investimento continua </li></ul><ul><li>Use Linq To SQL em cenário que não necessita de mapeamento intenso com o banco de dados </li></ul><ul><li>Prefira EF em maioria dos cenários (médios e complexos) </li></ul>
    41. 44. Resumo <ul><li>Use ADO.NET Data Services </li></ul><ul><ul><li>Fornecer dados via Web sem restrição de acesso </li></ul></ul><ul><ul><li>Fornecer dados via interfaces REST </li></ul></ul><ul><ul><li>Tenha atenção ao modelo de segurança (Web) e geração de proxy </li></ul></ul>
    42. 46. Recursos <ul><li>www.microsoft.com/teched </li></ul><ul><ul><li>Tech·Talks Tech·Ed Bloggers </li></ul></ul><ul><ul><li>Live Simulcasts Virtual Labs </li></ul></ul><ul><li>http://www.technetbrasil.com.br </li></ul><ul><ul><li>Avaliação de produtos finais e betas, conteúdo técnico em português e MUITO MAIS! </li></ul></ul><ul><li>http://www.msdnbrasil.com.br </li></ul><ul><ul><li>Developer’s Kit, conteúdo técnico em português, e MUITO MAIS! </li></ul></ul>
    43. 47. Sessões Relacionadas <ul><li>DAT401 – Dicas e truques do LINQ, Entity Framework, Linq To Sql e Expressões Lambda </li></ul><ul><li>Data: 25/08/2009 – 15:00 – 16:15 – Sala 509 </li></ul><ul><li>DAT202 – Novidades do Entity Framework 4.0 </li></ul><ul><li>Data: 27/08/2009 – 10:30 – 11:45 – Sala 509 </li></ul><ul><li>DAT301 – Usando o Entity Framework na construção de aplicações </li></ul><ul><li>Data: 26/08/2009 – 10:30 – 11:45 – Sala 509 </li></ul><ul><li>DAT301R – Usando o Entity Framework na construção de aplicações </li></ul><ul><li>Data: 27/08/2009 – 16:45 – 18:00 – Sala 510 </li></ul>
    44. 48. Links e Recursos <ul><li>Blogs </li></ul><ul><ul><li>http://blogs.msdn.com/adonet - Time do Entity Framework </li></ul></ul><ul><ul><li>http://blogs.msdn.com/efdesign - Time do Design do Entity Framework </li></ul></ul><ul><ul><li>http:// blogs.msdn.com/adonet/archive/2008/10/07/migrating-from-linq-to-sql-to-entity-framework-eager-loading.aspx - Migrando de Linq To sql para Entity Framework </li></ul></ul><ul><li>Sites Microsoft </li></ul><ul><ul><li>http:// msdn.microsoft.com/en-us/data/default.aspx - MSDN EUA </li></ul></ul><ul><ul><li>http://msdn.microsoft.com/pt-br/netframework - MSDN Brasil </li></ul></ul><ul><ul><li>http:// msdn.microsoft.com/en-us/library/bb399572.aspx - Entity Framework Overview </li></ul></ul>
    45. 49. Links e Recursos <ul><li>Arquitetura </li></ul><ul><ul><li>http://channel9.msdn.com/tags/ArqPod / - Podcasts sobre Arquitetura </li></ul></ul><ul><ul><li>http://channel9.msdn.com/Brasil - Vídeos de Arquitetura da MS Brasil </li></ul></ul><ul><ul><li>http://apparchguide.codeplex.com - Arquitetura de Referência </li></ul></ul><ul><li>Condé </li></ul><ul><ul><li>http://blogs.msdn.com/conde - Meu Blog </li></ul></ul><ul><ul><li>http://twitter.com/luconde - Twitter </li></ul></ul><ul><ul><li>[email_address] </li></ul></ul>
    46. 50. Por favor preencha a avaliação
    47. 51. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

    ×