0% found this document useful (0 votes)
85 views14 pages

Unit 4

Uploaded by

drhypnotoad19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
85 views14 pages

Unit 4

Uploaded by

drhypnotoad19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 14
—UNTT WN. | ro | system 10 » Streams ay | Textuuriter | TextReader . | o Binary quoriter : i Rivary Reacter Lobject a | Serialized “Object peleanes g formato) t | Remotin ¢ | poe Lf ADOenet I | — FE C# winelous form for data coutro | Grid : E Dataseurce and databinding controls Connected & Disconnected scenarios -— ADod- net system Bota datwet Conve cHows i Adopters commands | datqreaders _ 8 eda System LO The System.10_ namespace thax Voxtoux ~ __clowes that_are used. i operations voit file a! 4 oceliea. He “fen creakin __im thes Aa 2m storage | “fee « Q_Stream m_ Of bytes} operakiou, ‘om directories ; a 9 Drvelnfo 2 StringWriter t TH | These clawes com be vseck to veads and “1 Provide information, for the drives, @ File: Help fn mianipulating files. leTnfo + Used for performing operations ou fil e Stream + Used 3 to read feom ar and rite location q ile. . from a byte stream “9 StreamWriter t T+ is used for writing —____ Characters to 4 Streany sed vead ing a String budfeY is vsed for wri Oo Sting butter. ito comrist of LO related 43 & enumerati | System, T0_ namespace AM y Struchire, del write data Sia ici Stream A file ts a collection of lata ~ stored im a disk with a spediite | name and a clirector path - 4 When a file is opened. -for reading. or wrtting , i becomes, A Stream, t? : a OB wii mat “Te steam is ol byte pamin path: “Here_ “ae basfcally Whe sequence Arrevg h “The commonigeriy -qwo Mei sheamy: |} 7 e Input sheam } T4 ts. used fer} reading deta from | ule. 2 2 Oulput steam % TH is ued for writing ivto the file- . Cae Text vuritey cap Texdwriter class is an abstract chys. sy is used to write 404 ov sequential series Of characters juto pile. Ty is found iw System «LO namespace. Ty is a base chy of Steamriter and string writer « code? Using System; ? Using System. TOs namespace Text WriterExample < chy Program £ static. vote Main (shingC) arg) { | Using (Testuvitey writer = File. Geade | : Tent (Tesi hd} “© unite uubticLine (" HeMle c#")s ie write WhiieLine | Text uriter info”); | Gonroles WriteLine (" succenspaul” > fetrtt = Helloc# | Textubiter info “Ge TertReader chy fs found th. Syste _Memeypase + T+ vepresent a read ou be to read Sof Charackys- a aS series 8 base Clay oh StreamReader ond > SteingReader- Joa @de: > C# GH BinavyWriter cl fs used fo write binary information _ into steams Tris found in System-IO nemespace. cae | supports | are ushing in spedic encoding - ces a bel __ using System 5 _osing, Syste namespace BinarytiriterExoneple { ‘ _ chs Program 1 _ Stakic void Moin Sting filename = inary file « dad”; using ( BinaryWriier writer = new _ Rinany Writer (Files Open (filenome, ‘FileMode . Create ))) } | 5 Cat Binoy yReadey 7 ; 2 sialic void ReadRinary File() { C# BinaryReader clay fs used to read > _ using (Binary Reader reader = new Binay, Binary iugormatiow “fre steam: yo Reader'( FilesOper('@ Mbivary file sat”, is koond iw SysteucsTO namespace. ileMode+ Opeu)) ) i Es Te abyo supp i a 1 Specific ence 7 Rowyatee Write Line (weaders Re lel), Courole + Write Lie( readers Read Stringl) ; Cownle + Vorite Line (Teader + Reed Basleox) ~ Using Syslera using System TO; Tamepace BinaytrHiyExomple {_ = staife void. ei srg rate) : _ Writ tg —_ Static void to lietFnayee TY (Bin y Writer writ = new Singpyldritf _(Filevopeu ("eN binenyfileded Y, | Hela fs ing); 7 __writty while Cree 5 Serialfeation con be defined as the Proce of converting Hie State Of au Object fastance to & Stream of aig: so thax cou be ‘Fawspor ted acrose Network -or Can be persisted + ah Storage Jocactour + Tis main purpose is to save they State om object im order +a be able) cto recreate tt when needed. 48_O_skeam | €., Stream mey | Mm About the iH _veysion j ( ae There are three types of serialicatou im Net + 3. Binary Sevialiaation + Tt is tne proce Where we converd owt «Net Sbject into byte sheam. Tn binary serialization ow the public, private seven those which ave read members Ave serfalixed avid Yucto pyter. only, converted 2. SOAP serialization + SOAP fs @ proba bared on XML 5 designed Speci}icatly to trauaport procediue calls Using XML E+ Ts tre proce, OL seviatizing.@ onet Object to the re Cy ¥ML | oy from au XML Jo” «Nek “object | 3. XML Serialization + The veverse pron of sevfawization i Ceuted desertatization . Serialization is Frrternatty used fn YEMore applications. i TB serialixe the objects We need te opply SeralizableAthibute Cite’ bakes ciudeut s= new Stodeut ( 101," Forse") - to the Sb clow?+ apy an they formatter Serialize( stream 38)5 Ss. zo cexcepHiou. is ie ~ “ok — Tuactive. 5 Stream, Close) 5 aes Ben eo a - busing System _ a _# Using System + OS usin g System. -Runtime- Serialixatiou. Feta Léeriatizatle) 2 “Cie. ‘Student L- Ae we con see tne serialized lata is | j~ stored iw ane file To get ine data, we need 1 perform Clesevializettion, Peserializatiow Object) Putlic_calss Sei wa _ Static Bnwats ede OpexOrCreade)y, i rai matty = "ew Bi = - "feritst; | >. | 4 Siming the stake or docta of Oa objegps: Persistence Tuto “Eile y memory » database ete. is called as persistente tn CH | Serialization is used to PesGt the state of au object fe ae Fevststeict abject ave the object that > can be Saved tO Gud restore from a data stores, + Pevsitent objects represcut the 4 veeerd im a table aud encapsulate! | att yequricd -reletioustaps- We con use - Binasy 4 _persist au object's data’ Frstuaces »wtich enables sto Store | value aud retieve than the néxt » Hme the object fs imstanHated? | formatter gormater is the abstract base chi for alt ‘yuniime Serialization yormatie aad ovides Some helper meted, | for Feaplementing the farina inienoce The Fermatiey also manger queving- object ‘yer serialization © aul generating IDs fo on a p past. is requried ~YyML y JSON, BSON , YAML, MeniagePack gute Some commenly used — lect serializotion ormasins- a ~ Sysiem-Rowime -Sevialization amespate | Remoting= The -Net Remoting proides ah intvero Process Commonicttion ‘belween Application» Domains by using Remoting Framework. > “The application cau be located Om the > Same Compuiers , different computers a On the Same NEkvork, oY on Com pusey > AQcrOss Separate nekworks. The -Nel > Remoting Supports clistibuted abject. + Conmunications over the TOP aud HTTP] Channels by _ using Binary er S0AP fermatiers of tne data _ Stream . 4 “Re three components of a _Remoti actualy the client Framework ae i © C# Remotatle Object invok © CH Remote Listener “| Object’ © GE Ren S “The Remote Object is implemented | m a Clas hat derives from System. Marshal ByRe} Object : When a client calls’ “the Remote metud, doer wot Cau ‘the meted’ divechy « T+ receives Q proxy othe remote object aval is -used to ‘the method’ on the Rerote ve Client Once the prox “yeceives the meted _ call “from tne Client, H cheddar” ‘the “message using appropiate (Binary or SORP formatters) the Conbiguration file: 'apier that it sends the call to the. Server by using selected Channe! Cjfep Channel or HttpChonnel). The Server side channel ‘reeelves the = _crequest= from The proxy ond forwards! e_ Server on Remating Systm} locate, oad > invokes. the a on tHe Remote Object. | Of. Temote meted 4 ay “result from the a alk axe retwmned back to the a _ eliew a the. Same. way. ream object: instance aha Rewotable type com be creme , Ht nus be Ouated ond fuitfolized by ore Kuewr Os ACHYoskipn.”: Grid A Giid confi o collection of objets ; wien are’ iu UTE lee ud the Childvee poseporty- Grid ses The —GridLength * object +o define {the sizing chonac ters of 8 RowDefivitiou oy Column depivition. Tl a child element ts added +o 4 columk Witkin 4 Grid , Oud Hee i tolomn hay’ its Width “properly cet | +o Auto; the dtld will be mcasuied | witout yetvictows. i Code : : : t Grid mytrid = new ridl); ? t rey Grid Wide = 2505 | my Grid etlelgue = 1005“ | my (rid « Hovizorrtal Alignment: = i fig Hori zontarAlignments left | my Grid + VerticolAlignmen+ = ” j Vertical Alignment +-4op my Grid. Srowtyrid ines = deve. 5 Windows forms allow vs to bind eaully > “to__nearly any Structure That Contain, > data + : a With data binding ,we clo not needed) to explicity ust The code Thea: = Imstontiaies a connection dud creda > Q dataset + : 3 On the baris The number of bound | voles that tain be clisplayed through | O oko! of a Window form, 2 binding can be clmified tudo s Simple data bindin © Complex data binding bind a contro! “fo 4 single dada - Clee. otenkiat __ bind rusre thaw one dota eleurut 4o tontrod. omhenchenebinsbewel | bails. Connected and Distennected Scenarios _ Connected_and Seesere’ Scenarios shere ave two’ wows Ceomnected & aisconnected ) when persisting an” ” cut with the Entity framework . Beth © ways have theiy own rrportance. Connecti “Scenario: fs wher an’ entity is Yetrieved from Ihe dalabase “oud rodiffed fm tne some contert. Discommected Scenario’ is when an entity is retrieved from the clalabae “anh raoaified iw tne different Context, ADO. NET The +NET framework include data access ~Fechnology ADO.NET fc the. latest. THs Own ie ADO.NET, > implementaty, of inicrasoptls Universal Data Access} Stealergy - ADO+NET consists _ that _atbows to ~ of managed clise, T_applicatfons +o conned) dota sources such a3_ mfcroso Server, Microsok Access , Oracle XML a, execute commands auc manage as _ disconnected evosolt ADO.NET is, the latest homer - hier ADO y introduced in he | io version 95 fis __=NET__ Framework ky which helb Providing an extensive array of _ Yoxtguy cctutes fo hamelle _ latte im difineud nundes, Such a Connected modke and _ disconnected mode. Th tomectd mode, we ave cS usith live dada oud in discommecied? mode, cata is provided. from tne _ sails _ held, but when there axe mul __te be held athey must be held Seperadely. deta Stove. ADO-NET Was primaril developed to _ address two ways +50 work with data that we cre getting “from datth sources: The two ways sre follows + 4. The first ts +0 do ulth the User's meed 40 access deda once and _ 4o iterate tmovgh & coltecHou a dota in_a_ single Instance. < 2. The second way to’ “Gerk’ with dala. is disconnected architedkit-e: Be as in ‘which we have to! gx : collection of clata and we use _ Ws dota seperelely from the data Store: Haety- Tn connected mode , a single fabl he tables Th connected mode , object are forward — only ‘ead ~ only 5 wonile: in, diswnnected mode , they can process data a = 7 dimension’ ‘ . any. Connection : The Connection abject is. the 6 firs! important component £ ; 1 our application. T+ fs vequried to The ADO-NET architecture comprises § “ ape backend elatasese “MMe May impertart Components. The: a tl egnnect sac 2 folto coenponeie§:_ They. o°2 9 fe SQL Server , Oracle, MySQL ek. We ‘ollows ; Ie, 3 4. Connecti . | mus? hove Hws fhings fo Create a 2 Gomma a connection object - Cur database Maching See ~ $: Se a 3. Data Reader nome OF Address OY Semeplace 4. DataAdabter wnete tt is Stored. & The Second g dataseh Shing 1S Seaunlty crecentfals such as ¢ Dadaview | neiney HS a Windows “authenHeatfon ——— ~ er username and password —based authentication - connection 7s Created using the | hepa sttewch Kornectde Tp Te fords jeader connection object = and a backend skich rel] disconnect S must ie tres < } urce must s@ Connected +8 Dee fread ed paiaset Ly temacr | TS : t ected f e whch Cu i, using the connectfon | brewsed fase . or backwand d . free 8 alse ydat? = Command + The cond fmpor tant Fet grove —passaaeni component Ts HhE+ Command abject + When we discuss databases, such as SQL Seley, Oracle, MySéL, Hen Speak SOL 4 ft ts the Command object That we Ose 4o create SAL fF querfes. Adttr we created our SOL Architecture | [acine] gees | Of ADO-NET | 4 mylGL, the J Ses as we we can execu’ the, Adapter: The Data Adapter _ oe the Se eiton Using the ") pata P erjorms aN operation v Connecr® al Command object. We Can go- either 4) ne cata om the Comman Dataser ox the Dakakeader way ui oe and ie write tne data DTS. Fn general we Shovld chooce] OY 5 the dataset which méelned we requre bared on | SE she Situation - - =] poeta View Clas: A Dataview enables us Cwe can go either the Dasaser oy +o modify the appearance the Datakeadey way with OTS.) aj the dotastore ina Tae 5 a 4 sota—binelin skill that fs frequently DerlaReader : We can only ead the employed int data ~ view pplicaaions —__,_ recor fm tre _ferwarg | ye may abtey the sort order of data rode wih Datakeader. Here swe im a table ov filter it besed on Tow swe familfovixe oussel SH th stare or OM Gf filter expremion Using “Fond Tad only , connected a Dasaview. ward _ vuodes ce j DataSet + A clisconneckd recordset | {can be browsed fh both | | divection sand it fs alse possible +o 7 | _isert y update or delete clata s Te pat LAdapiey fills a Docraset Using “cage - an

You might also like