dot_net

Document Sample
dot_net Powered By Docstoc
					   .Net Framework
     Introduction
     Hagay Lupesko
Microsoft consulting student
     Microsoft-Israel
      Agenda
• Introduction to .Net
• CLR - Common Language
  Runtime.
• WinForms.
• ADO.NET
      Agenda
• Introduction to .Net
• CLR - Common Language
  Runtime.
• WinForms
• ADO.NET
Introduction to .Net
Why develop a new platform?
• Inter-Platform communication – almost
  impossible.
• DLL-Hell – Deployment and versioning
  conflicts.
• Security threats.
• Dynamic web programming –
  complicated, slow, “ugly”.

Conclusion: No adequate platform for
 network oriented computing.
Introduction to .Net
  The .Net vision
Make information available
   anytime, anywhere.
   Introduction to .Net
.Net Main Features – realizing the vision.

 • Managed Run Time Environment (CLR) – manages
   code, memory, security, threading.
 • Inter-Language development –all .Net languages are
   compiled to MSIL – the .Net assembly.
 • Strong support for network standards: Http, XML,
   SOAP, WSDL, and more.
 • Built in support for Web-Services.
 • ASP.NET – Easy and efficient development of
   dynamic web apps.
 • WinForms – Easy GUI development.
 • Surly I left something out…
      Agenda
• Introduction to .Net
• CLR - Common Language
  Runtime.
• WinForms
• ADO.NET
                     The CLR
                    Compilation




Source code                                  Assembly

                          Compiler
                        Csc.exe / Vbc.exe
C++, C#, J#,            / Cl.exe / Vjc.exe   DLL or EXE
Visual Basic or
any .NET
language

     csc /target:library CSClass.cs
The CLR
Assembly

CSClass.DLL

 Metadata

    IL
 Managed
   code

 Resources
                                   The CLR
                                  Compilation




                   Compiling, ILDASM, IL
D:\Program Files\Microsoft Visual Studio .NET\Frame workSDK\Tool Developers Guide\docs\Partition III CIL.doc
                The CLR
               Components


 Thread Support         COM Marshaler

  Type Checker         Exception Manager

 Security Engine           Debug Engine

IL to Native      Code          Garbage
 Compilers       Manager        Collector

               Class Loader
                      The CLR
                 The execution model
Source      VB             C#             C++
code
                                                   Unmanaged
          Compiler      Compiler        Compiler
                                                   component

Managed   Assembly      Assembly        Assembly
code       IL code       IL code         IL code



   Common language runtime

                     JIT compiler


                          Native code


                     Operating system services
      The CLR
     Compilation




Inter-Lang Inheritance
                 The CLR
        Intermediate Language (IL)

• Object Oriented
  – Single inheritance
  – Multiple implementation of Interfaces
• Value Types Vs. Reference Types
• Operations performed on Virtual Stack
                         The CLR
                         Example
.method private static void Main(string[] args) cil managed
{
  .entrypoint
  .maxstack 3
  .locals init (int32 V_0, int32 V_1, int32 V_2)
  ldarg.0
  ldc.i4.0
  ldelem.ref
  call        int32 [mscorlib]System.Int32::Parse(string)
  ldarg.0
  ldc.i4.1
  ldelem.ref
  call        int32 [mscorlib]System.Int32::Parse(string)
  add
  call        void [mscorlib]System.Console::WriteLine(int32)
  ret
} // end of method Greeter::Main
                       The CLR
                       Example
//… code omitted for clarity
ldarg.0
ldc.i4.0
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
//… code omitted for clarity

                           args




                     Virtual Stack
                       The CLR
                       Example
//… code omitted for clarity
ldarg.0
ldc.i4.0
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
//… code omitted for clarity

                             0
                           args




                     Virtual Stack
                      The CLR
                      Example
//… code omitted for clarity
ldarg.0
ldc.i4.0
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
//… code omitted for clarity

                          “23”




                    Virtual Stack
                       The CLR
                       Example
//… code omitted for clarity
ldarg.0
ldc.i4.0
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
//… code omitted for clarity

                            23




                     Virtual Stack
                        The CLR
                        Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret

                            args
                             23




                      Virtual Stack
                         The CLR
                         Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret

                              1
                            args
                             23



                      Virtual Stack
                        The CLR
                        Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret

                            “32”
                             23




                      Virtual Stack
                        The CLR
                        Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret

                             32
                             23




                      Virtual Stack
                        The CLR
                        Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret

                             55




                      Virtual Stack
                       The CLR
                       Example
//… code omitted for clarity
ldarg.0
ldc.i4.1
ldelem.ref
call       int32 [mscorlib]System.Int32::Parse(string)
add
call       void [mscorlib]System.Console::WriteLine(int32)
ret




                      Virtual Stack
           The CLR
     Opening MS source code
Why do that?
• In-depth Understanding of features and
  classes.
• Improvement of algorithms.
• Debugging “VOODOO” problems.
• Find bugs.
• Pure fun…
          The CLR
    Opening MS source code
• Anakrino: Can be found at
  www.saurik.com -including source!
• Other companies do the same (but
  for money…)
• It’s not perfect.
• Maybe you can make it better???
             The CLR
       Opening MS source code




Revealing .Net Base Classes Source code
      Agenda
• Introduction to .Net
• CLR - Common Language
  Runtime.
• WinForms
• ADO.NET
              WinForms

What do we gain?
• Simple Event driven programming model
• Rich GUI control classes – Over 30
• Fast & Easy GUI building
• Simple deployment – Just use xcopy…
• Programmers can focus on the Program’s
logic!
        WinForms




Building first WinForm using
          NotePad
           WinForms
Event Driven Programming Model
EventHandler – a method that is bound to an
event (button click / mouse over …)
• Signature:
void button1_Click(object sender, System.EventArgs e)

• When the event is fired – the methods are
invoked.
• Multiple EventHandlers can be
dinamically assigned to an event.
             WinForms




Adding event handling to our WinForm
            WinForms
 Developing with VisualStudio.NET




Building a diary using VisualStudio .Net
      Agenda
• Introduction to .Net
• CLR - Common Language
  Runtime.
• WinForms
• ADO.NET
                 ADO.NET
                 Basic View

Main classes:
•DataAdapter – a proxy to the SQL server
•DataSet – mini-db at your fingertips
•DataGrid – Allows GUI of the DataSet
               ADO.NET
               Basic View
 DataAdapter


SelectCommand               Database
InsertCommand
UpdateCommand
DeleteCommand


TableMappings
                            DataSet
        ADO.NET
        Basic View




Building ADO.NET application
             .Net Framework




Building a rich client using VisualStudio .Net

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:15
posted:11/11/2011
language:English
pages:50