1 / 24

Enterprise Library

Enterprise Library. Łukasz Rzeszot s3083 Maciej Mućka s3047. Agenda. Enterprise Library Overview Enterprise Library Contents Application Blocks analysis Summary. Łukasz Rzeszot s3083 Maciej Mućka s3047. Enterprise Library Overview.

lwinter
Download Presentation

Enterprise Library

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Enterprise Library Łukasz Rzeszot s3083 MaciejMućka s3047

  2. Agenda • Enterprise Library Overview • Enterprise Library Contents • Application Blocks analysis • Summary Łukasz Rzeszot s3083 MaciejMućka s3047

  3. Enterprise Library Overview • Kind of guidance, design pattern how to write applications • Set of Application Blocks • Assumptions: • Supporting best Microsoft reccomended practicies for .NET applications • Reusing Application Blocks • Modifying existing code • Ready to use ‘as is’ • All AppBlocks are cohesive • Not an Microsoft product created by MS Communities Łukasz Rzeszot s3083 MaciejMućka s3047

  4. Enterprise Library Contents Application Blocks: • Configuration • Cashing • Data Access • Cryptography • Exception Handling • Logging & Instrumentation • Security Łukasz Rzeszot s3083 MaciejMućka s3047

  5. Configuration Application Block • Application configuration can be a connection string, user preferences etc. • Storage types: *.xml file, windows *.ini file, in Windows registry, in db • Different environments require different solutions of storing configuration data • Important factors: security, integrity, influence of storage solution on application performance • EntLib solution: module which enables to keep the configuration data with the best method for the application, allows to change configuration data without recompilation of the code, creating cofiguration sections eg. Color configuration Łukasz Rzeszot s3083 MaciejMućka s3047

  6. Configuration Application Block Łukasz Rzeszot s3083 MaciejMućka s3047

  7. Configuration Application Block Getting configuration data: ConfigurationManager.GetConfiguration("ColorSettings"); Writing configuration data: ConfigurationManager.WriteConfiguration("ColorSettings",color); Łukasz Rzeszot s3083 MaciejMućka s3047

  8. Data Access Application Block • DAAB simplifies development tasks that implement common data access functionality • Is used to reading data for display, obtaining data, submitting data back to the database system • Suport for in-line SQL and stored procedures • Provides access to the most frequently used features of ADO.NET • Allows the code to remain uniform across multiple database servers (SQL Server, Oracle, DB2) • Application code can refer to particular databases by name. Łukasz Rzeszot s3083 MaciejMućka s3047

  9. Data Access Application Block Łukasz Rzeszot s3083 MaciejMućka s3047

  10. Data Access Application Block //create the connection string and sql to be executed string strConnTxt = "Server=(local);Database=Northwind;Integrated Security=True;"; string strSql = "select * from products where categoryid = 1"; //create and open the connection object SqlConnection objConn = new SqlConnection(strConnTxt); objConn.Open(); //Create the command object SqlCommand objCmd = new SqlCommand(strSql, objConn); objCmd.CommandType = CommandType.Text; //databind the datagrid by calling the ExecuteReader() method DataGrid1.DataSource = objCmd.ExecuteReader(); DataGrid1.DataBind(); //close the connection objConn.Close(); Łukasz Rzeszot s3083 MaciejMućka s3047

  11. Data Access Application Block 2 //create the connection string and sql to be executed string strSql = "select * from products where categoryid = 1"; string strConnTxt = "Server=(local);Database=Northwind;Integrated Security=True;"; DataGrid4.DataSource = SqlHelper.ExecuteReader(strConnTxt, CommandType.Text, strSql); DataGrid4.DataBind(); Łukasz Rzeszot s3083 MaciejMućka s3047

  12. Data Access Application Block 3 string connectionString = (string) ConfigurationSettings.AppSettings["ConnectionString"]; SqlConnection connection = new SqlConnection(connectionString); SqlCommand command = new SqlCommand("INSERT_PERSON",connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@Name",SqlDbType.NVarChar,50)); command.Parameters["@Name"].Value = txtName.Text; command.Parameters.Add(new SqlParameter("@Age",SqlDbType.NVarChar,10)); command.Parameters["@Age"].Value = txtAge.Text; connection.Open(); command.ExecuteNonQuery(); connection.Close(); Łukasz Rzeszot s3083 MaciejMućka s3047

  13. Data Access Application Block 4 using Microsoft.ApplicationBlocks.Data; SqlHelper.ExecuteNonQuery(connection,"INSERT_PERSON",new SqlParameter("@Name",txtName.Text) ,new SqlParameter("@Age",txtAge.Text) ); Łukasz Rzeszot s3083 MaciejMućka s3047

  14. Cryptography Application Block • Simplifies the cryptography functionality of the application • Can be used for: encrypting information, creating a hash from data, comparing hash values to verify that data has not changed • Abstracts code from cryptography provider • Allows changing cryptography provider through configuration changing Łukasz Rzeszot s3083 MaciejMućka s3047

  15. Cryptography Application Block Łukasz Rzeszot s3083 MaciejMućka s3047

  16. Cryptography Application Block Decrypting data: string decryptedData = Cryptographer.DecryptSymmetric( "MySymmetricProvider", "Data to decrypt"); Encrypting data: string encryptedData = Cryptographer.EncryptSymmetric( "MySymmetricProvider", "Data to encrypt"); Creating hash: string hashValue = Cryptographer.CreateHash( "MyHashProvider", "Data to hash"); Comparing hash: bool theSame = Cryptographer.CompareHash( "MyHashProvider", "stringToCompare", "generated hash value"); Łukasz Rzeszot s3083 MaciejMućka s3047

  17. Security Application Block • Collects many of the most common security tasks • Provides code for scenarios: • Authentication • Authorisation • Role management • Profile management • Provides interaction with different security providers: MS Active Directory, Authorization Manager, Active Directory Application Mode, custom databases Łukasz Rzeszot s3083 MaciejMućka s3047

  18. Security Application Block Łukasz Rzeszot s3083 MaciejMućka s3047

  19. Caching Application Block • It supports both an in-momory cache and optionaly a backing-store • Configurable expritaion and scavenging policies are part of the application block’s functionality • Cache stores: repeatedly access static data, data that rarely changes, data which access, transport and creation is expensive, data that should be accessible even without working source Łukasz Rzeszot s3083 MaciejMućka s3047

  20. Caching Application Block • Improves performance: data are stored near data consumer • Scalability: storing information in a cache helps save resources and increases scalability as the demands on the application increase • Availability: storing data in cache enables application to survive while the system failures ( network latency) Łukasz Rzeszot s3083 MaciejMućka s3047

  21. Caching Application Block • It can be used with: • Windows forms • Console • Windows service Łukasz Rzeszot s3083 MaciejMućka s3047

  22. Caching Application Block Design to achieve aims like: • Providing easy to manage API for the programmer • To allow developers to incorporate the standard caching operations into their applications without having to learn the internal workings of the application block • To be thread safe • To ensure that the backing store remains intact if an exception occurs while it is being accessed • To make sure that the states of the in-memory cache and the backing store remain synchronized Łukasz Rzeszot s3083 MaciejMućka s3047

  23. Caching Application Block Łukasz Rzeszot s3083 MaciejMućka s3047

  24. Source:http://www.google.comhttp://msdn.microsoft.com Łukasz Rzeszot s3083 MaciejMućka s3047

More Related