![Page 1: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/1.jpg)
Migración a Visual Basic .NET
Rodrigo Bruno
Application Development Consultant
Soporte Premier a Desarrolladores
![Page 2: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/2.jpg)
Objetivos …
Explicar porqué un desarrollador de VB6 debería pasar a VB.NET
Ayudar/facilitar la transición de VB6 a VB.NET
![Page 3: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/3.jpg)
Agenda Referencias: Guías de arquitectura, diseño y
código Arquitectura del .NET Framework y la CLR Estrategias de migración VB6 vs VB.NET: Diferencias en el lenguaje Acceso a datos: ADO.NET Asistente de Actualización de Aplicaciones Interoperabilidad con COM Implantación de aplicaciones (no touch) Seguridad en el .NET Framework
![Page 4: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/4.jpg)
1.- Guías de arquitectura / diseño y código
Guías de Arquitectura (PAG) Estándares de desarrollo Application Blocks Guías de migración
![Page 5: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/5.jpg)
Guías de arquitectura Guías de diseño para aplicaciones .NET
Muestran como encaja todo junto Blueprint para decisiones a nivel de diseño
Alto riesgo en la etapa de diseño Arquitectos son contrarios al riesgo
No es una solución para todos los diseños Hay escenarios específicos
Preservar las inversiones “¿Tendré que rehacer todo en el futuro?”
![Page 6: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/6.jpg)
UI ComponentsUI Components
Opera
tional M
anagem
ent
Opera
tional M
anagem
ent
Secu
ritySecu
rity
Com
munica
tion
Com
munica
tion
UI Process ComponentsUI Process Components
Data Access ComponentsData Access Components
Business WorkflowsBusiness Workflows
Business ComponentsBusiness Components
Users and DevicesUsers and Devices
Data Sources
Business EntitiesBusiness Entities
ServicesSvc InterfacesSvc Interfaces
Svc AgentsSvc Agents
Guías de Arquitectura
BusinessBusiness
PresentationPresentation
Data Data
![Page 7: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/7.jpg)
Guías de Arquitectura Application Architecture for .NET: Designing Applications and Services .NET Data Access Architecture Guide Building Secure ASP.NET Applications Debugging .NET Applications Exception Management in .NET .NET/COM Migration and Interoperability Monitoring in .NET Deploying .NET Applications Team Development with SourceSafe UNIX Code Migration Guide
http://msdn.microsoft.com/practices/
![Page 8: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/8.jpg)
Estándares de desarrollo Ayudan a escribir código robusto y seguro
que funciona de manera consistente con el Framework .NET
Facilitan la propiedad colectiva del código .NET Framework Design Guidelines
http://msdn.microsoft.com/library/en-us/cpgenref/html/cpconnetframeworkdesignguidelines.asp
FxCop: analiza el código managed para chequear las prácticas recomendadas http://www.gotdotnet.com/team/libraries/
![Page 9: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/9.jpg)
Application Blocks Data Access Application Block for .NET
Componente .NET que contiene código optimizado de acceso a datos
Exception Management Application Block for .NET Provee un framework simple y extensible para
manejar excepciones
![Page 10: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/10.jpg)
Referencias Estrategia de migración:
Microsoft .NET/COM Migration and Interoperability: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cominterop.asp
Guía de migración a .NET: Upgrading to .NET:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/upgradingtodotnet.asp
Guía específica para VB: Upgrade to Visual Basic .NET from Visual Basic 6.0:
http://msdn.microsoft.com/vbasic/techinfo/articles/upgrade/default.asp
Visual Studio 2003: http://msdn.microsoft.com/vbasic/productinfo/vbasic03/features/
default.asp
![Page 11: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/11.jpg)
2.- Arquitectura del .NET Framework y la CLR
Objetivos de diseñoArquitecturaBeneficiosCompilación
![Page 12: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/12.jpg)
Introducción a .NETObjetivos de diseño de .NET Framework
Entorno consistente de orientación a objetos: mismo modelo para ejecución local, código remoto o
entorno distribuido en Internet Minimizar conflictos: implantación y versiones Proporcionar ejecución segura de código Eliminar problemas de rendimiento de código
interpretado o con scripting Mayor productividad del desarrollador tanto para
aplicaciones Windows como Web Comunicación basada en estándares de la industria
![Page 13: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/13.jpg)
Introducción a .NETFramework, Lenguajes y Herramientas
Sistema OperativoSistema Operativo
Common Language RuntimeCommon Language Runtime
Base Class LibraryBase Class Library
ADO.NET y XMLADO.NET y XML
ASP.NETASP.NETWeb Forms Web ServicesWeb Forms Web Services
Mobile Internet ToolkitMobile Internet Toolkit
WindowsWindowsFormsForms
(.NET CF)(.NET CF)
Common Language SpecificationCommon Language Specification
VBVB C++C++ C#C# JScriptJScript® J#J#
Visu
al S
tud
ioV
isua
l Stu
dio
® .NE
T .N
ET
![Page 14: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/14.jpg)
System System
System.DataSystem.Data System.XmlSystem.Xml
System.WebSystem.Web
GlobalizationGlobalization
DiagnosticsDiagnostics
ConfigurationConfiguration
CollectionsCollections
ResourcesResources
ReflectionReflection
NetNet
IOIO
ThreadingThreading
TextText
ServiceProcessServiceProcess
SecuritySecurity
CommonCommon
OleDbOleDb
SQLTypesSQLTypes
SqlClientSqlClient
XPathXPath
XSLTXSLT
RuntimeRuntimeInteropServicesInteropServices
RemotingRemoting
SerializationSerialization
SerializationSerialization
ConfigurationConfiguration SessionStateSessionState
CachingCaching SecuritySecurity
ServicesServicesDescriptionDescription
DiscoveryDiscovery
ProtocolsProtocols
UIUIHtmlControlsHtmlControls
WebControlsWebControls
System.DrawingSystem.Drawing
ImagingImaging
Drawing2DDrawing2D
TextText
PrintingPrinting
System.Windows.FormsSystem.Windows.Forms
DesignDesign ComponentModelComponentModel
Introducción a .NETFramework, Languajes y herramientas
![Page 15: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/15.jpg)
Introducción a .NETBeneficios del .NET Framework
Simplifica el desarrollo y la implantación Proporciona un entorno de ejecución seguro
y robusto Unifica modelos de programación Soporta múltiples lenguajes de programación Independiente de la plataforma
![Page 16: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/16.jpg)
Introducción a .NET Beneficios del .NET Framework
Sistema común de tipos Instancias y definición de tipos comunes
Orientación a objetos: Clases e interfaces Constructores, propiedades, métodos, eventos Herencia cruzada entre lenguajes
Interoperabilidad Con COM Con DLLs nativas (del estilo Win32)
![Page 17: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/17.jpg)
Introducción a .NET Beneficios del .NET Framework
Elimina la “fontanería” de COM No más …
Registro
GUIDs
Archivos .IDL
HRESULTs
IUnknown
AddRef/Release
CoCreateInstance
=>Aps autodescriptivas=>Aps autodescriptivas
=>namespaces jerárquicos=>namespaces jerárquicos
=>objetos autodescriptivos=>objetos autodescriptivos
=>excepciones estructuradas=>excepciones estructuradas
=>objeto raiz común=>objeto raiz común
=>garbage collector=>garbage collector
=>operador ”new”=>operador ”new”
![Page 18: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/18.jpg)
AssemblyAssembly
Introducción a .NETCompilación y ejecución
Código Código fuentefuente
Compilador Compilador del del
lenguajelenguaje
CompilaciónCompilación
En instalación o la En instalación o la primera vez que se primera vez que se
invoca a cada invoca a cada métodométodo
EjecuciónEjecución
Compilador Compilador JITJIT
Código Código NativoNativo
Código (IL)Código (IL)
MetadatosMetadatos
![Page 19: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/19.jpg)
3.- VB6 vs VB.NET: Diferencias en el lenguaje
Visual Basic 6 vs. Visual Basic .NET Compatibilidad con Visual Basic 6 Cambios a nivel de código
![Page 20: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/20.jpg)
Se echaba en falta en VB6 ...
No totalmente orientado a objetos: herencia No se pueden crear aplicaciones free-
threaded Evitar problemas de registro y versiones Una programación Web menos compleja
(respecto a la programación Windows) Mecanismos para evitar fugas de memoria Un tratamiento de errores más potente Runtime integrada
![Page 21: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/21.jpg)
Novedades del lenguaje
Herencia, sobrecarga, polimorfismo, constructores, …
Free-threading (procesamiento asíncrono) No se usa el registry Programación Web: ASP.NET Recolector de basura
![Page 22: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/22.jpg)
Novedades del lenguaje (2) Control de errores estructurado:
Try … Catch La runtime de VB.NET forma parte del Framework.
Incluida en el redistribuible Más:
Punteros a funciones (delegates), nuevos tipos de datos, comprobación estricta de tipos, …
![Page 23: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/23.jpg)
VB.NET no es VB6 + nuevas características Nuevas características requieren rediseño Nuevo formato de ficheros Interoperabilidad entre lenguajes Integración con .NET framework
¿ Compatibilidad ?No es fácil
![Page 24: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/24.jpg)
Librería de compatibilidad Microsoft.VisualBasic.Compatibility Cuando no haya nada equivalente Cuando lo equivalente sea muy diferente VB6.<nombre de función> No recomendable su utilización
'VB6
Form1.Show
Form1.Show vbModal
Form1.Show X
'Visual Basic.NET
Form1.Show
Form1.ShowDialog
VB6.ShowForm(Form1, X)
![Page 25: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/25.jpg)
Cambios a nivel de código Tipos Variant: sustituidos por Object No hay propiedades por defecto Variables a nivel de bloque Las llamadas a procedimiento necesitan paréntesis Los procedimientos permiten Return Los parámetros son ByVal por defecto Posible declarar & inicializar variables Más …
![Page 26: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/26.jpg)
Imports System.MathNamespace Geometria
Public Module Module1 Sub Main() Dim tri As New Triangulo(2, 3, 4) Console.WriteLine(tri.CalcularArea()) Console.WriteLine(Circulo.Area(5)) End Sub End Module
Public Class Triangulo Dim m_a, m_b, m_c As Integer
Public Sub New() End Sub
Public Sub New (ByVal a As Integer, ByVal b As Integer, ByVal c As Integer) m_a = a : m_b = b : m_c = c End Sub Public Function CalcularArea() As Double Dim s As Double = (m_a + m_b + m_c) / 2 Return Sqrt(s * (s – m_a) * (s – m_b) * (s – m_c)) End Function End Class
Public Class Circulo Public Shared Function Area(ByVal r As Double) As Double Return Pi * (r ^ 2) End Function End Class
End Namespace
![Page 27: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/27.jpg)
Demo 1Novedades del lenguaje
![Page 28: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/28.jpg)
4.- Acceso a datos: ADO.NET
ADO vs ADO.NET Características de ADO.NET Arquitectura Enlace a datos (binding)
![Page 29: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/29.jpg)
ADO trabaja bien, pero: Necesita COM y Windows Los recordsets no viajan bien a través de
Internet ADO.NET resuelve estos problemas:
Utiliza XML (a bajo nivel) para realizar el transporte de datos
XML no tiene requisitos específicos de runtime/transporte No se necesita un código especial para hacer el
marshaling a través de Internet
ADO .NET, una nueva mentalidad: Entorno desconectado Todo el transporte de datos utiliza XML
ADO vs ADO.NET
![Page 30: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/30.jpg)
ADO.NET DBLib, ODBC, DAO, RDO, ADO, …. ADO.NET System.Data: la clase raiz A partir de ahí, principales namespaces:
System.Data.OleDB System.Data.SQLClient System.Data.ODBC, System.Data.OracleClient
System.XML: para trabajar directamente con XML
![Page 31: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/31.jpg)
ADO.NET System.Data.OleDb: trabaja con todas
las fuentes OLE DB Soporta unmanaged providers de ADO
System.Data.SQLClient: sólo SQL Server (managed)
VStudio 2003: System.Data.ODBC, System.Data.OracleClient
![Page 32: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/32.jpg)
NegocioNegocio DatosDatos
PresentaciónPresentación
Windows FormsWindows Forms
Web formsWeb forms
Business to businessBusiness to business
Data object (class)Data object (class)
DataSetDataSet
DataSetDataSetDataSetDataSet
InternetInternetintranetintranet
Data adapterData adapter
Data adapterData adapter
(BizTalk, por ejemplo)(BizTalk, por ejemplo)
XmlXml
MiAp.ExeMiAp.Exe
IEIE
Arquitectura de ADO.NET
![Page 33: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/33.jpg)
Buffer de datos
Acceso a datos
DataAdapterDataSet
Diferencia fundamental
Buffer de datos
Acceso a datos
RecordsetEn ADO:
En ADO.NET:
![Page 34: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/34.jpg)
ADO.NET: Connection
OleDbConnection/SQLConnection Representa la sesión contra la BD Utilizados por objetos Data Adapter y Command
para recuperar/actualizar Inicia las transacciones
Connection.BeginTransaction() devuelve un objeto Transaction
xxxTransaction Un comando se enlista en una transacción IsolationLevel Commit() / Rollback()
Configuración del pool de conexiones en el connection string
![Page 35: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/35.jpg)
ADO.NET: Command OleDbCommand/SQLCommand Representa Transact-SQL o procedimientos
almacenados Devuelve un resultset (ExecuteReader), un
valor (ExecuteScalar), o ejecuta sentencias de modificación (ExecuteNonQuery)
Generación automática con el objeto CommandBuilder
![Page 36: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/36.jpg)
ADO.NET: DataReader
OleDbDataReader/SQLDataReader Stream forward-only read-only Utilizado por el DataAdapter Muy rápido Creado por un objeto Command
(ExecuteReader)
![Page 37: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/37.jpg)
ADO.NET: DataAdapter OleDbDataAdapter/SQLDataAdapter Representa un conjunto de Commands y una
Connection Puente entre el DataSet y la BD Lee y actualiza la BD:
SelectCommand, UpdateCommand, InsertCommand, DeleteCommand
![Page 38: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/38.jpg)
ADO.NET – DataAdapter
DataAdapterDataAdapter
SelectCommandSelectCommand
InsertCommandInsertCommand
UpdateCommandUpdateCommand
DeleteCommandDeleteCommand
TableMappingsTableMappings
Base de datosBase de datos
DataSetDataSet
![Page 39: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/39.jpg)
ADO.NET: DataSet Objeto estrella en ADO.NET Representa una caché de datos en memoria Contiene DataTables Lee y escribe datos y esquemas en XML Serializable Puede ser tipado o no tipado:
Ambos heredan de la clase DataSet El tipado se apoya en un esquema XML (.XSD)
para generar la clase El tipado tiene ventajas:
Expone estructura como propiedades y métodos: Intellisense
Recoge la Primary key
![Page 40: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/40.jpg)
ADO.NET: Otros objetos
DataTable Representa una tabla en memoria Lo rellena un DataAdapter o a mano Componente principal de los objetos DataSet y
DataView DataView
Vista personalizada de un objeto DataTable Filtros, ordenación, búsquedas …
DataRelation Define relaciones entre tablas Utiliza columnas de un DataTable
![Page 41: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/41.jpg)
ADO.NET - DataSet
DataSetDataSet
DataTableDataTable
DataTableDataTable
DataRowDataRow
DataColumnDataColumn
RelationsRelations
ConstraintsConstraintsXML SchemaXML Schema
![Page 42: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/42.jpg)
ADO.NET: Lecturas
Método Fill del objeto DataAdapter Se utiliza el SelectCommand del DataAdapter Inserta/actualiza datos del DataSet
Si la tabla existe, actualiza datos Si no existe, crea y rellena la tabla Una tabla por cada resultset
Mantiene la conexión en su estado original
![Page 43: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/43.jpg)
ADO.NET: Actualizaciones La funcionalidad en ADO es implícita.
Recordset = caja negra. Ejemplo: UpdateBatch
En ADO.NET: Se crea un modelo más explícito y transparente. InsertCommand, UpdateCommand,
DeleteCommand Eventos de Update
CommandBuilder: generación automática de los comandos de Insert, Update y Delete a partir del SelectCommand
![Page 44: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/44.jpg)
ADO.NET: Actualizaciones DataAdapter.Update:
Analiza los cambios del DataSet Ejecuta los comandos Insert, Update y
Delete necesarios Refresca el DataSet
Orden de ejecución por defecto: Insert, Update y Delete.
![Page 45: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/45.jpg)
ADO.NET: Enlace a datos ADO .NET soporta enlazar (binding)
DataSets a Windows Forms / Web Forms y sus controles
VStudio .NET incluye bastantes wizards para hacer el enlace entre datos y controles
![Page 46: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/46.jpg)
Demo 2: Aplicación maestro-
detalle
![Page 47: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/47.jpg)
5.- Asistente de actualización de aplicaciones: código
Consideraciones Asistente: lo no soportado Upgrade Wizard Final de la actualización
![Page 48: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/48.jpg)
Consideraciones Opciones
Continuar con VB6 Interoperar entre VB6 y VB.NET Actualizar a VB .NET
El nuevo código .NET podrá ser: Creado desde cero Migrado Upgrade Wizard
Ventajas de la actualización Aprovechar las características del .NET Framework Aprovechar las características de Visual Basic .NET
Desventajas de la actualización Algunas características no se actualizan Más trabajo de desarrollo y pruebas
La actualización de código es sólo una parte
![Page 49: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/49.jpg)
Consideraciones
Migración horizontal Una sola capa, al
completo
Migración vertical Aislar y reemplazar una
parte en todas las capas
![Page 50: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/50.jpg)
Consideraciones
Elegir una estrategia que minimice el riesgo Elegir actividades que permitan continuar
utilizando la base de código COM mientras nos movemos a .NET
Sacar partido rápidamente a las nuevas funcionalidades del entorno .NET
Factores a tener en cuenta: Aislamiento Nueva funcionalidad Uso intensivo de recordsets entre capas Arquitectura existente
![Page 51: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/51.jpg)
Asistente: lo no soportado
Data binding de DAO y RDO Controles de Visual Basic 5.0 Aplicaciones DHTML ActiveX® documents Páginas de propiedades Add-ins Controles de usuario (Web classes)
![Page 52: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/52.jpg)
Upgrade WizardAspecto del formularioAspecto del formulario
Controles ActiveXControles ActiveX
ADO (data binding)ADO (data binding)
CódigoCódigo
Cambios de sintaxisCambios de sintaxis
Librerías COMLibrerías COM
Archivos .RESArchivos .RES
Avisos de comportamientoAvisos de comportamiento
![Page 53: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/53.jpg)
Final de la actualización
Proyecto Visual Basic .NET El Upgrade Wizard enumera:
Upgrade issues Upgrade to-dos Upgrade warnings Upgrade notes
Completar los cambios Compilar la aplicación
![Page 54: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/54.jpg)
Demo 3: Upgrade Wizard
![Page 55: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/55.jpg)
6.- Interoperabilidad con COM
Migrar o interoperar COM y .NET Llamadas desde .NET a COM Llamadas desde COM a .NET
![Page 56: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/56.jpg)
Migrar o interoperar Migrar
Todo el código en un entorno consistente Actualizar para tomar ventaja de .NET
Interoperar Reutilizar código existente Preservar inversiones Acceso a funcionalidad no migrable
![Page 57: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/57.jpg)
COM y .NET Componentes DCOM COM+ Recordset </> IUnknown/IDispatch GUID/CLSID/etc
Assemblies Remoting EnterpriseServices DataSet Serialization </> </>
![Page 58: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/58.jpg)
COM y .NET
.NET utilizando COM Los tipos .NET pueden acceder a tipos COM Vuelta al registry y a las limitaciones de implantación actuales
COM utilizando .NET Los tipos COM pueden acceder a tipos .NET
.NET.NET
COMCOM
COMCOM
.NET.NET
![Page 59: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/59.jpg)
Llamadas desde .NET a COM
Common Common Language RuntimeLanguage Runtime
Servidor COMServidor COM
Referencias por contador
Referenciastraceadas
ClienteCliente
Runtime Runtime Callable Wrapper Callable Wrapper
ObjetoObjeto
RCW:Creado con Visual Studio .NET ò tlbimp.exePrimary interop assembly
Marshal.ReleaseComObject()
![Page 60: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/60.jpg)
COM COM CallableCallableWrapperWrapper
Common Common Language RuntimeLanguage Runtime
Llamadas desde COM a .NET
ObjetoObjeto
Referenciastraceadas
Referencias por contador
Servidor COMServidor COMIUnknownIUnknownIDispatchIDispatch
IPropioIPropio
IPropioIPropio
ClienteCliente
![Page 61: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/61.jpg)
Llamadas desde COM a .NET Creación del assembly .NET:
Definir interface en el componente Tipos públicos Opcional: crear strong name e incluir en la GAC
COM Callable Wrapper Crear el assembly con Visual Studio .NET Exportar la librería de tipos con tlbexp.exe
Hacer que el assembly esté disponible para COM regasm.exe, ò Global Assembly Cache (GAC)
![Page 62: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/62.jpg)
Demo 4:COM Interop
![Page 63: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/63.jpg)
7.- ImplantaciónSmart Clients
Consideraciones Nuevas opciones No-Touch Seguridad Apoyos
![Page 64: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/64.jpg)
Implantación Consideraciones Impacto en el sistema
¿ La instalación de la aplicación 1 romperá la aplicación 2 ?
Implantación la primera vez Cada cliente debe tener la aplicación
explícitamente instalada
Actualización de la aplicación Si hay cambios en el interfaz de usuario, cada
cliente debe reinstalar la aplicación para actualizarse
![Page 65: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/65.jpg)
Implantación Consideraciones
Problema a resolver: Ejecutar o actualizar una aplicación sin
tocar el cliente
Si ya utilizamos un software de gestión de instalaciones (IntelliMirror, SMS, etc), continuar utilizándolo.
![Page 66: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/66.jpg)
Implantación Consideraciones
Las aplicaciones son aisladas Implantación privada por defecto Las aplicaciones son autodescriptivas
Pueden coexistir múltiples versiones La compartición es controlada y explícita:
Strong name, GAC
Por defecto, las aplicaciones utilizan el assembly con el que fueron construidas, no la última versión
Side-by-side
![Page 67: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/67.jpg)
Implantación Nuevas opciones
La implantación es simple XCOPY en el cliente Ejecución desde un recurso de red Click sobre un enlace en el browser (no touch)
No-touch deployment Por defecto, aislamiento de aplicaciones No se necesita registro Componentes compartidos (strong names,
versión)
![Page 68: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/68.jpg)
Implantación No touch
MiApp.exeMiApp.exe
Web ServerWeb Server
Internet Internet ExplorerExplorer
Download Download CacheCache
Aplicación Aplicación clientecliente
.NET .NET FrameworkFramework
Managed Managed Exe?Exe?
MiApp.dllMiApp.dll
HTTPHTTP
HTTPHTTP
![Page 69: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/69.jpg)
Implantación No-Touch
Ejecutable lanzado como URL (IEEXec) Sin instalación, actualización automática
Click en un link en el browser El EXE y los assemblies referenciados se descargan Otros assemblies: utilizar Assembly.LoadFrom
Almacenamiento en download cache C:\Documents and Settings\usuario\Local Settings\Application Data\assembly
Descarga sólo cuando hay actualizaciones Por usuario
Descarga de assemblies dependientes: según se van necesitando
![Page 70: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/70.jpg)
Implantación No-Touch con loader
Otra opción: EXE local pequeño: loader Carga de assemblies desde un Web server
La aplicación se descarga en tiempo de ejecución Para actualizar la aplicación, actualizar los
assemblies del servidor
Para cargar los assemblies: Assembly.LoadFrom(URL)
URL: URL a un assembly Descarga y cachea el assembly Chequeo automático de nuevas versiones Permisos: depende de dónde viene el assembly
![Page 71: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/71.jpg)
Implantación Seguridad
Las aplicaciones son semi-confiables Se ejecutan, y pueden realizar un número limitado
de tareas Seguridad en función del origen de la aplicación
(de dónde viene) Similar a páginas web en el browser
Configuración de seguridad: herramienta .NET Framework Configuration
Strong names Proporcionan un grado de seguridad mayor Distinto de signcode
![Page 72: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/72.jpg)
Implantación Apoyos
Auto Updater (componente): .NET Client Applications: .NET Application
Updater Component http://www.gotdotnet.com/team/windowsforms/appupdater.aspx
Artículo en MSDN Magazine: Write Auto-Updating Apps with .NET and
the Background Intelligent Transfer Service API (utiliza Windows Update) http://msdn.microsoft.com/msdnmag/issues/03/02/BITS/default.aspx
![Page 73: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/73.jpg)
Demo 5:No Touch Deployment
![Page 74: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/74.jpg)
8.- Seguridaden el .NET Framework
Conceptos de seguridad Seguridad basada en roles Autenticación Autorización
![Page 75: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/75.jpg)
Seguridad ¿Qué se quiere evitar?
Acceso no controlado a la aplicación, por parte de usuarios no conocidos
Acceso ilimitado a toda la aplicación, por parte de usuarios autenticados
Qué aporta .NET: Nuevas herramientas para proteger la información del
usuario (ej. System.Security.Cryptography) Acceso al código
Code-access security (evidencias)
Acceso de usuarios * De Windows Genéricos
![Page 76: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/76.jpg)
SeguridadUsuarios: seguridad basada en roles
Roles con una serie de permisos Fácil administración Soporte para
Grupos de Windows Roles genéricos
Import de: System.Threading System.Security.Principal
Enterprise Services también dispone de roles
![Page 77: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/77.jpg)
SeguridadAutenticación
Identificar al usuario Verificar sus credenciales
Seguridad Windows Base de datos Archivo XML
Creación del objeto Identity Identifica al usuario Tipo de autenticación: Windows o Generic
Creación del objeto Principal Incluye el Identity y almacena la pertenencia al role
Se aplica a usuarios Genéricos y de Windows
![Page 78: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/78.jpg)
Seguridad Autenticación
Usuario de Windows
Dim winIdentity as WindowsIdentity = WindowsIdentity.GetCurrent()Dim winPrincipal As New WindowsPrincipal(winIdentity)Thread.CurrentPrincipal = winPrincipal
Usuario Generic
Dim genIdentity as New GenericIdentity(“John”)Dim Roles() as String = {“Employee”,”Manager”}Dim genPrincipal As New GenericPrincipal(genIdentity, Roles)Thread.CurrentPrincipal = genPrincipal
![Page 79: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/79.jpg)
Seguridad Autorización
Proceso de autorización de acceso El usuario ya ha sido autenticado El usuario solicita realizar una tarea Se comprueba la pertenencia al role Se restringe el acceso a ciertas partes de la aplicación
![Page 80: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/80.jpg)
Seguridad Autorización
Usuarios Windows / Generic
If Thread.CurrentPrincipal.IsInRole(“Manager”) Or _ Thread.CurrentPrincipal.IsInRole(“BuiltIn\Admministrators”) ThenBindEmployeesGrid()BindEmployeeDetailsGrid()bnViewSalaryReport.Enabled = True
ElseBindEmployeeGrid()bnViewSalaryReport.Enabled = False
End If
![Page 81: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/81.jpg)
Demo 6:Seguridad en las
aplicaciones
![Page 82: Migración a Visual Basic.NET Rodrigo Bruno Application Development Consultant Soporte Premier a Desarrolladores](https://reader031.vdocuments.net/reader031/viewer/2022020717/54a7806f497959eb6d8b48c0/html5/thumbnails/82.jpg)
Preguntas / Dudas
</>