Vous êtes sur la page 1sur 27

A TRAINING REPORT ON DEVELOPING ENTERPRISE APPLICATIONS USING .

NET FRAMEWORK Submitted in partial fulfillment of the requirement for

BACHELOR DEGREE IN COMPUTER SCIENCE AND ENGINEERING 2010-11


UNDER

NIIT,KANPUR
Submitted To Mr. Navin T a!i"#.O.D$ Submitted By S !ETA TRIPAT I"#$#%&%##$'(

Acknowledgement

This Training is aims at learning about the DEVELOPING ENTERPRISE APPLICATIONS USING .NET RA!E"OR# at NIIT #ANPUR$ un%er the gui%an&e o' Ms. Meenu Shrivastava I ta(e this gol%en o))ortunit* to e+)ress m* sin&ere than(s to Mr. Ashish ,-ea% o' Center. /ho gui%e us in e0er* )ossible /a* in our training. I am also thankful with my deep sense of gratitude towards my loving parents for their inspiring encouragement and unbound affection.

SHWETA TRIPATHI 0701910076 C.S. final yr.

CONTENTS
1. Introduction

2. .Net framework 3. Why .Net !. Net "u##orted lan$ua$e" %.&lateform Inde#endence !. 'i"ual "tudio .Net %. &ro(ect

INTRODUCTION
.N)* i" a ma(or technolo$y chan$e for +icro"oft and the "oftware world. ,u"t like the com#uter world mo-ed from ./S to Window"0 now they are mo-in$ to .N)*. 1ut don2t 3e "ur#ri"ed if you find anyone "ayin$ that 4I do not like .N)* and I would "tick with the $ood old C/+ and C5 54. *here are "till lot of #eo#le who like to u"e the 3ullock6cart in"tead of the late"t 7onda car.

*he "im#le an"wer i" 2it is the technology f o! Mic osoft" on #hich $ll othe Mic osoft technologies #ill %e &e'en&ing on in f(t( e)2.

.N)* technolo$y wa" introduced 3y +icro"oft0 to catch the market from the S8N2" ,a-a. 9ew year" 3ack0 +icro"oft had only 'C55 and '1 to com#ete with ,a-a0 3ut ,a-a wa" catchin$ the market -ery fa"t. With the world de#endin$ more and more the Internet:We3 and (a-a related tool" 3ecomin$ the 3e"t choice for the we3 a##lication"0 +icro"oft "eemed to 3e loo"in$ the 3attle. *hou"and" of #ro$rammer" mo-ed to (a-a from 'C55 and '1. *hi" wa" alarmin$ for +icro"oft and many of the

+icro"oft fan2" ke#t on a"kin$ 4i" +icro"oft "lee#in$ 4. ;nd +icro"oft had the an"wer. /ne fine mornin$0 they announced < 4We are not "lee#in$. We ha-e the an"wer for you.4. ;nd that an"wer wa" .N)*.

1ut +icro"oft ha" a wonderful hi"tory of "tartin$ late 3ut catchin$ u# =uickly. *hi" i" true in ca"e of .N)* too. +icro"oft #ut their 3e"t men at work for a "ecret #ro(ect called Ne>t ?eneration Window" Ser-ice" @N?WSA.0 under the direct "u#er-i"ion of +r. 1ill ?ate". *he outcome of the #ro(ect i" what we now know a" .N)*. )-en thou$h .N)* ha" 3orrowed mo"t of it2" idea" from Sun2" ,2))0 it ha" really out#erformed their com#etitor".

+icro"oft2" 'C55 wa" a #owerful tool. 1ut it wa" too com#le>. It ha" too many dataty#e"0 and de-elo#er" had to learn many li3rarie" includin$ WIndow" S.B0 +9C0 ;*C0 C/+ etc. *here were many dataty#e com#ati3ility i""ue" while e>chan$in$ data 3etween different layer". 'i"ual 1a"ic wa" too ea"y0 and many "eriou" #ro$rammer" hated it (u"t for that rea"on. )-en thou$h 'i"ual 3a"ic wa" -ery ea"y to u"e0 it wa" not -ery fle>i3le to de-elo# "eriou" a##lication". S8N2" ,a-a 3ecame a -ery $ood choice for the"e rea"on". It had the fli>i3ility and #ower of C55 and at the "ame time ea"y enou$h to catch the attention of '1 #ro$rammer".

+icro"oft reco$ni"ed the"e factor" and they introducd the .N)* con"iderin$ all the"e factor". ;ll unwanted com#le>itie" are eliminated and a #ure o3(ect oriented #ro$rammin$ model wa" introduced. *hi" make" #ro$rammer2" life -ery ea"y.

.N)* framework come" with a "in$le cla"" li3rary. ;nd that" all #ro$rammer" need to learnDD Whether they write the code in CE or '1.N)* or ,E0 it doe"n2t matter0 you (u"t u"e the .N)* cla"" li3rary. *here i" no cla""e" "#ecific to any lan$ua$e. *here i" nothin$ more you can do in a lan$ua$e0 which you can2t do in any other .N)* lan$ua$e. Fou can write code in CE or '1.N)* with the "ame num3er of line" of code0 "ame #erformance and "ame efficiency0 3ecau"e e-eyone u"e" "ame .N)* cla"" li3rary.

What is .NET ? 16It i" a #latform neutral framework. 26I" a layer 3etween the o#eratin$ "y"tem and the #ro$rammin$ lan$ua$e. 36 It "u##ort" many #ro$rammin$ lan$ua$e"0 includin$ '1.N)*0 CE etc. !6.N)* #ro-ide" a common "et of cla"" li3rarie"0 which can 3e acce""ed from any .N)* 3a"ed #ro$rammin$ lan$ua$e. *here will not 3e "e#arate "et of cla""e" and li3rarie" for each lan$ua$e. If you know any one .N)* lan$ua$e0 you can write code in any .N)* lan$ua$eDD %6In future -er"ion" of Window"0 .N)* will 3e freely di"tri3uted a" #art of o#eratin$ "y"tem and u"er" will ne-er ha-e to in"tall .N)* "e#arately.

What is Not ? 1 .N)* i" not an o#eratin$ "y"tem. 2 .N)* i" not a #ro$rammin$ lan$ua$e. 34.N)* i" a framework4

)NET * $!e#o +
.N)* 9ramework i" a "oftware that #ro-ide" a "et of li3rarie" called a" 1a"e Cla"" Ci3rary @1CCA0 Common Can$ua$e Guntime @CCGA0 Com#iler"0 additional tool" like ?;C8*IC.)H)0 SN.)H) etc.

VERSIONS .N)* 9ramework ha" different -er"ion" 1.0 1.1 2.0 3.0

3.% !.0

Where we can find the .NET Framework? ;ll -er"ion of .N)* 9ramework are #laced under the folder C<IWindow"I+icro"oft.N)*I9ramework

Different frameworks availa le for .NET Develo!ment?

1. .N)* 9ramework from +icro"oft a. Su##ort all .N)* 3a"ed lan$ua$e" 3. Can work with Window" /nly c. It i" #ro#rietary 2. +ono 9ramework from No-ell a. Su##ort few lan$ua$e" like CE and Gu3y 3. Can work on any #latform c. It i" o#en "ource

Why )NET,
-)NET technology #$s int o&(ce& %y Mic osoft" to c$tch the !$ +et f o! the SUN.s /$0$)1

.N)* i" made with certain $oal" 100J utiliKation of e>i"tin$ knowled$e of a #er"on u"in$ different "et of lan$ua$e" which are 3a"ed on .N)* 9ramework o CE o '1 o ,E o 9E o &ythen.N)* o Gu3y.N)* o C/1/C.N)* o )tc.

;ny kind of de-elo#ment u"in$ any one lan$ua$e o Con"ole ;##lication o Window" ;##lication o We3 ;##lication o +o3ile ;##lication o Window Ser-ice o We3 Ser-ice ;ll lan$ua$e $et com#iled into a common format called a" +SIC @+icro"oft Intermediate Can$ua$eA or CIC @Common Intermediate Can$ua$eA a" .e>e or .dll ;ll lan$ua$e 3ecome" intero#era3le 3ecau"e of +SIC code *o make a #ro$ram a" intero#era3le it mu"t follow CCS @Common Can$ua$e S#ecificationA com#liancy rule" like CE #ro$ram will not ha-e the #ointer"0 two -aria3le" with "ame name etc. ;ll lan$ua$e are o3(ect oriented /nly one "oftware i" re=uired to run #ro$am" written in any lan$ua$e called a" CCG @Common Can$ua$e

GuntimeA

;ll lan$ua$e" "hare the data ty#e" from Common *y#e Sy"tem @C*SA. C*S i" a collection" of "tructure" and cla""e" that $et ma##ed to "ome data ty#e of a lan$ua$e o Sy"tem.Int32 "tructure of ! 3yte" inte$ral o Sy"tem.Int6! "tructure of L 3yte" inte$ral o Sy"tem.Sin$le "tructure of ! 3yte" floatin$ o Sy"tem..ou3le "tructure of L 3yte" floatin$ o Sy"tem..ecimal "tructure of 16 3yte" floatin$ o Sy"tem.Strin$ cla"" to hold addre"" of "ome "trin$ o Sy"tem./3(ect cla"" to hold addre"" of any ty#e ;ll "uch C*S ty#e" $et ma##ed 3y different lan$ua$e" o CE int Sy"tem.Int32

float Sy"tem.Sin$le o '1 Inte$er Sy"tem.Int32 Sin$le Sy"tem.Sin$le

Sin$le I.) called a" 'i"ual Studio.N)* for Ga#id ;##lication .e-elo#ment @G;.A o 2001 o 2003 o 200% o 200L o 2010 No more M.CC 7ellN HC/&F 3a"ed in"tallation Side 3y Side )>ecution of a""em3lie" Inte$ration of technolo$ie" from other -endor" o ;,;H from ?oo$le o We3 Ser-ice &ro-ide" technolo$ie" and "er-ice"

o CINO @Can$ua$e Inte$rated OueryA o W9 @Window Workflow 9oundation"A o W&9 @Window" &re"entation 9oundationA o WC9 @Window" Communication 9oundationA o H;+C @eHtended ;##lication +arku# Can$ua$eA o Sil-erli$ht

It i" al"o a-aila3le in /#en Source +odel that can run on any o#eratin$ "y"tem u"in$ Mono * $!e#o + $i-en 3y No-ell. It "u##ort" -ery few lan$ua$e" like CE0 Gu3y etc.

)Net S(''o te& L$ng($ge


1. CE 2. '1 3. ,E !. 9E %. &ythen.N)* 6. Gu3y.N)* 7. C/1/C.N)*

*he a3o-e lan$ua$e" are from +icro"oft. +any third #artie" are writin$ com#iler" for other lan$ua$e" with .N)* "u##ort..ifference 3etween '1 and '1.N)*1elie-e u"0 there i" not much in common 3etween '1 and '1.N)* other than the name. '1.N)* i" a totally new

#ro$rammin$ lan$ua$e. It (u"t retain" the "ynta> of old '1. So0 if you are a -3 #ro$rammer0 #ro3a3ly you may like '1.N)* than CE (u"t 3ecau"e of the "ynta>.

In addition to thi"0 '1.N)* "till "u##ort many of the old '1 function" (u"t for 3ackward com#ati3ility. 1ut if you are a "eriou" .N)* #ro$rammer0 we "tron$ly "u$$e"t ne-er u"e old '1 function" in '1.N)*. So0 "witchin$ from '1 to '1.N)* i" (u"t like learnin$ a new #ro$rammin$ lan$ua$e0 with -ery "mall "imilaritie" 3etween them.

"# or V$.NET ? Which one to choose ?

;" we mentioned in earlier 0 it make" no much difference. Whether you write code in '1.N)* or CE0 when you com#ile0 your code will $et con-erted to +SIC @+icro"oft Intermediate lan$ua$eA. It i" thi" +SIC which you deli-er to your cu"tomer in the form of a .CC or )H). *he +SIC i" e>ecuted 3y the "ame .N)* framework0 whether you wrote it ori$inally in CE or '1.N)*.

*he +SIC $enerated 3y CE and '1.N)* i" almo"t 99J i" the "ameD +any 3elie-e that CE ha" the #ower of C55 and '1.N)* ha" the u"er friendline"" of '1. *hat i" not true. 1oth are e=ually #owerfull and friendly.

'1.N)* ha" 3ackward com#ati3ility with old 'i"ual 3a"ic. So0 it "u##ort" old -3 function". CE i" a fre"h0 clean lan$ua$e. So "tron$ly "u##ort u"in$ CE in"tead of '1.N)* (u"t for thi" clean com#iler.

+any old '1 $uy" u"ually like to "tick with '1.N)* and are kind of "cared of CE. We are "ure that you will not take more than few day" to $et familiar with CE "ynta>. *hi" online tutorial i" 3a"ed on CE and all "am#le" will 3e #ro-ided in CE.

Is it !latform inde!endent ?
+any #eo#le a"k thi" =ue"tion 4,a-a i" #latform

inde#endent0 what a3out .N)* 4. *he an"wer i" 4Fe"4 and 4No4 D *he code you write i" 'l$tfo ! in&e'en&ent0 3ecau"e whate-er you write i" $ettin$ com#iled into +SIC. *here i" no nati-e code0 which de#end" on your o#eratin$ "y"tem or C&8. 1ut when you e>ecute the +SIC0 the .N)* framework in the tar$et "y"tem will con-ert the +SIC into nati-e #latform code. So0 if you run your .N)* e>e in a WIndow" machine0 the .N)* framework for Window" will con-ert it into Window" nati-e code and e>ecute. If you run your .N)* a##lication in 8ni> or Cinu>0 the .N)* framework for 8ni>:Cinu>will con-ert your code into 8ni>:Cinu> nati-e code and e>ecute. So0 your code i" #urely #latform inde#endent and run" anywhereD 1ut wait0 we "aid it wron$... there i" no .N)* framework for 8ni> or Cinu>a-aila3le now. +icro"oft ha" written the .N)* framework only for Window". If you or "ome one el"e write a .N)* framework for other #latform" in future0 your code will run there too. So0 let u" wait until "omeone write .N)* framework for Cinu> 3efore you run your .N)* code in Cinu>. 9uture of .N)* +icro"oft i" mo-in$ all it" technolo$ie" to 3e .N)* 3a"ed or .N)* related. *he ne>t -er"ion of SOC Ser-er e-en "u##ort" writin$ "tored #rocedure" in .N)* lan$ua$e". .N)* runtime will 3e #art of all /#eratin$ Sy"tem" 3y default.

2ISUAL STUDIO)NET
What is Vis%al St%dio.NET ? +any #eo#le alway" $et confu"ed with 'i"ual Studio .N)* @'S.N)*A and .N)* technolo$y. 'S.N)* i" (u"t an editor0 #ro-ided 3y +icro"oft to hel# de-elo#er" write .N)* #ro$ram" ea"ily . 'S.N)* editor automatically $enerate" lot of code0 allow" de-elo#er" to dra$ and dro# control" to a form0 #ro-ide "hort cut" to com#ile and 3uild the a##lication etc.

&nderstand Vis%al St%dio .NET 'i"ualStudio i" a -ery u"er friendly tool. 1ut there are enou$h "tuff to confu"e any one new to 'i"ual Studio family. *he #ur#o"e of thi" cha#ter i" to make you familiar with different o#tion" in 'i"ual Studio.N)* @'S.N)*A We will not co-er the entire -i"ual "tudio $uide. We are (u"t e>#lainin$ the mo"t commonly u"ed feature" of 'S.N)*. When you work on any #ro(ect0 'S.N)* ha" "e-eral child window" to a""i"t you in the a##lication de-elo#ment. *he"e window" are attached on the left0 3ottom and ri$ht "ide" of the main window. Fou can click on the"e "mall window" to e>#and it and "ee the content of them. Some of the mo"t commonly u"ed child window" are e>#lained 3elow. +o"t of the"e window" will 3e ena3led only when you ha-e created a #ro(ect and workin$ on a We39orm:Win9orm.

Tool%o3 *ool3o> #ro-ide" all the dra$ and dro# control" for your a##lication. .e#endin$ on the kind of a##lication you are workin$ on0 the tool3o> will "how a##ro#riate control" and you can dra$ and dro# them to your form. If you are de-elo#in$ a we3 a##lication0 tool3o> will "how ;S&.N)* control" and if you are de-elo#in$ a Window" a##lication0 it will "how Window" control" @like Gadio 3utton0 te>t 3o>0 3utton" etcA. Fou can "im#ly dra$ and dro# any control" from the tool3o> to your form. ;fter you dra$ and dro# any control0 dou3le click on the control to $o the default e-ent a""ociated with the control. *he *ool3o> will 3e ena3led only when you ha-e a We39orm or Win9orm o#ened in .e"i$n mode and i" u"ually located on */& C)9* corner of the 'S.N)*. 1y default0 all window" includin$ *ool3o> will 3e di"#layed a" +inimiKed @+arked a" ; in #ictureA. Fou will "ee only the "mall icon and the te>t 2*ool3o>2 written -ertically on the left 3ar of 'S.N)*. Fou can click on thi" minimiKed window to e>#and it @)>#anded window i" marked a" C.A. When you mo-e the mou"e away from the window0 it will a$ain automatically minimiKe. Fou can kee# the tool3o> alway" e>#anded 3y #re""in$ the

#u"h#in @+arked with 1.A *he a3o-e 3eha-iour i" common for all the window" e>#lained 3elow. *hey will 3e minimiKed 3y default and you can #oint the mou"e o-er it to e>#and it. 8"e the #u"h3utton to kee# it e>#anded

Design !o&e 4 HTML !o&e If you are de-elo#in$ a we3 a##lication0 you can "witch 3etween de"i$n mode and 7*+C mode for any we3 form. When you are in 7*+C mode0 it will "how you the 7*+C ta$" and ;S&.N)* code and you can manually edit it. F/u can "witch to the .e"i$n mode 3y clickin$ the .e"i$n 3utton on 1/**/+ C)9* corner of 'S.N)*. In de"i$n mode0 you can "ee how your ;S&.N)* #a$e i" $oin$ to look like when "ome one -iew your we3 #a$e. ;l"o0 you can dra$ and dro# control" from the tool3o>0 which will automatically $enerate the 7*+C for it.*y#ically0 de-elo#er" "witch 3etween the"e two mode" -ery fre=uently. Fou can $o to de"i$n mode to dra$:dro# control"0 ri$ht click on the control" to "et correct #ro#ertie" etc. *hen0 click on the 7*+C mode to -iew the $enerated 7*+C. Fou can manually make chan$e" to the automatically $enerated 7*+C. If you chan$e any #ro#ertie" in 7*+C mode0 the chan$e" will 3e reflected when you "witch to .e"i$n +ode

Sol(tion E3'lo e Solution )>#lorer0 located on */& GI?7* corner of

'S.N)*0 di"#lay" your "olution0 all #ro(ect" included in each "olution and the li"t of file" in each #ro(ect. *hey are li"ted in the form of a tree control.*y#ically0 for a "in$le a##lication0 you will ha-e 1 "olution and one or more #ro(ect". When you create a new a##lication0 you are ha-e to create "in$le 'i"ual Studio #ro(ect. In more com#le> a##lication"0 there may 3e more than one #ro(ect". ;ll the"e #ro(ect" are $rou#ed into a "in$le "olution. )-en if you do not create a "olution "e#arately0 a "olution will 3e automatically created for you. *o add a new file to your #ro(ect0 you can ri$ht click on the #ro(ect name @,u"t*e"ti" the #ro(ect name in the #ictureA and choo"e the menu o#tion ;dd. It will $i-e you the o#tion to choo"e a file ty#e. Fou can choo"e an a##ro#riate ty#e. 9or Win9orm" and We39orm"0 you can "ee the file in de"i$n mode and the code a""ociated with it. .ou3le click on any form and it will 3e o#ened in de"i$n mode. Gi$ht click on any form and "elect the menu o#tion 2'iew Code2 to -iew the code a""ociate with the form.

O(t'(t /ut#ut window0 located on 1/**/+ C)9* corner of 'S.N)*0 di"#lay" the re"ult of your #ro(ect com#ilation. When you com#ile your #ro(ect0 all error"0 warnin$" and com#ilation re"ult" will 3e di"#layed in thi" window. In addition to the /ut#ut window0 they are few other window" located in the 1/**/+ C)9* corner of 'S.N)*.

Task 'ist 6 "how" indi-idual ta"k". *y#ically0 when you com#ile your #ro(ect0 all error" and warnin$" will 3e added to your ta"k li"t. Fou can dou3le click on any item in the ta"k li"t to $o directly to the code a""ociated with the ta"k

."ommand Window ( you can e>ecute code "tatement" here. When you are de3u$$in$0 you can e-aluate the -alue of any -aria3le" 3y ty#in$ followed 3y the -aria3le name.

9ind Ge"ult" 6 when you "earch for any te>t in file@"A u"in$ 'S.N)*0 the re"ult" will 3e di"#layed in thi" window.

P o5ects
'S.N)* allow" you to create "e-eral ty#e" of #ro(ect". +o"t of the time you will 3e u"in$ one of two cate$orie"<

1. Win&o#s A''lic$tion 6 to create any "tandard window" a##lication. 2.ASP)NET We% A''lic$tion 6 to create a we3 "ite.

"reatin) a *ro+ect *o create a new #ro(ect0 choo"e the main menu < 9ile P New P &ro(ect.

It will $i-e you "e-eral o#tion". 9ir"t you mu"t "elect a ty#e from the left "ide of the #o#u# 6 you may choo"e 'i"ual 1a"ic &ro(ect" or 'i"ual CE #ro(ect" 3a"ed on the lan$ua$e you #lan to u"e for de-elo#ment. ;fter "electin$ a ty#e0 you choo"e a tem#late from the ri$ht "ide. Fou may choo"e Window" ;##lication0 ;S&.N)* We3 ;##lication or any other tem#late3a"ed on the nature of the a##lication you want. When you create a Window" &ro(ect or ;S&.N)* We3 &ro(ect0 'S.N)* will add a "am#le file 3y default. Fou can "im#ly 1uild your new #ro(ect and "ee how it work".

$%ildin) a !ro+ect *o try thi"0 create a new Window" &ro(ect a" e>#lained a3o-e. It will create a "am#le form. ?o to the main menu and "elect the menu item 1uild P 1uild Solution. *hi" #roce"" will com#ile all the file" included in your #ro(ect and "how you the re"ult in the /ut#ut window. If the re"ult "how" 20 failed20 your 3uild i" "ucce"" and your a##lication i" ready to deli-erDD *o Gun the a##lication you (u"t 1uilt0 $o to the main menu and "elect .e3u$ P Start Without .e3u$$in$. *hi" will launch the a##lication you (u"t de-elo#ed. Fou can dra$ and dro# "e-eral control" to the form and try runnin$ it.

When you com#ile @3uildA the code0 if there i" any error" or warnin$"0 the detail" will 3e "hown in the 2*a"k Ci"t2 window. Fou can click on the "#ecific item in thi" window to $o directly to the line of code a""ociated with the error.

E,ec%tion of a !ro+ect Code Written in any lan$ua$e when com#iled $et con-erted to an 2Intermediate Can$ua$e2 @+icro"oft Intermediate Can$ua$e 6 +SICA. Com#iled e>ecuta3le contain" the IC and not really e>ecuta3le machine lan$ua$e. With the hel# of C.C.G.@common lan$ua$e runtimeA the IC code con-erted into machine e>ecuta3le code.

Vous aimerez peut-être aussi