Dotnet Quesans
Dotnet Quesans
Dotnet Quesans
with the SQL LIKE operator. Example of % Wildcard SELEC ! "#$% Students W&E#E 'ame LIKE ()in%(* +bo)e SQL statement selects all students with a 'ame startin, with -)in-. #I% in SQL
he #I% function is helped to remo)e specified prefix or suffix from a strin,. he most commonl/ we are usin, to remo)e white spaces.
SELEC # #I%0L #I%0( dotnettips1all (22 +S #I% SELEC # #I%0( SELEC L #I%0( dotnettips1all dotnettips1all (2 +S # #I% (2+S L #I%
What is LI'Q3 Lan,ua,e Inte,rated Quer/ 0LI'Q2, is a component released within the .'E 4.5 "ramewor6. It is one of the most powerful features of .'E 4.5. It ser)es the purpose of 7uer/in, ob8ects. LI'Q comprises a series of operators, which are used to 7uer/, filter and pro8ect data in arra/s, enumerable classes, relational databases and 9%L. In order to 7uer/ data, the data needs to be encapsulated as an ob8ect. In case the data source is not an ob8ect, it first needs to be con)erted to an ob8ect in order for LI'Q to 7uer/ it. LI'Q has its own Quer/ :rocessin, En,ine. he information returned b/ a LI'Q 7uer/ is a collection of in;memor/ ob8ect which ma/ be enumerated. he LI'Q concept treats the data source as an $b8ect, rather than a <atabase. So we ma/ sa/, its an ob8ect that is 7ueried. LI'Q ma/ 7uer/ an/ t/pe of data source, li6e. LI'Q 7uer/in, SQL 0%S SQL Ser)er supported2. LI'Q 7uer/in, <atasets 0Quer/in, is possible on <atasets and <ata ables2 LI'Q 7uer/in, $#% Solution LI'Q 7uer/in, $b8ects 0In;memor/ data ma/ be 7ueried2 LI'Q 7uer/in, 9%L 0Quer/in, is possible on 9%L data source &ow o =se Self >oin In S7l Ser)er Self >oin in SQL Ser)er ?@@@A?@@5 helps in retrie)in, the records ha)in, some relation or similarit/ with other records in the same database table. + common example of emplo/ees table can do more clearl/ about the self 8oin in s7l. Self 8oin in s7l means 8oinin, the sin,le table to itself. It creates the partial )iew of the sin,le table and retrie)es the related records. Bou can use aliases for the same table
to set a self 8oin between the sin,le table and retrie)e the records satisf/in, the condition in where clause. "or self 8oin in s7l /ou can tr/ the followin, example. Create table emplo/ees. empCid D Einoth 'ull ? :rabhu D 4 :rabha D 1 Sara)anan ? 5 Fabu ? G %uthu 5 H <inesh 5 empCname empCmana,erCid
'ow to ,et the names of mana,ers from the abo)e sin,le table /ou can use sub 7ueries or simpl/ the self 8oin. Self >oin SQL Quer/ to ,et the names of mana,er and emplo/ees. select eD.empCname (mana,er(,e?.empCname (emplo/ee( from emplo/ees eD 8oin emplo/ees e? on eD.empCidIe?.empCmana,erCid #esult. mana,er Einoth :rabhu Einoth :rabha :rabhu Sara)anan :rabhu Fabu Fabu %uthu Fabu <inesh =nderstandin, the Self >oin Example In the abo)e self 8oin 7uer/, emplo/ees table is 8oined with itself usin, table aliases eD and e?. his creates the two )iews of a sin,le table. emplo/ee
from emplo/ees eD 8oin emplo/ees e? on eD.empCidIe?.empCmana,erCid &ere e.empCmana,erCid passes the mana,er id from the ?nd )iew to the first aliased eD table to ,et the names of mana,ers. <ele,ate + dele,ate is a t/pe that references a method. $nce a dele,ate is assi,ned a method, it beha)es exactl/ li6e that method. he dele,ate method can be used li6e an/ other method, with parameters and a return )alue <ele,ates ha)e the followin, properties. <ele,ates are similar to CJJ function pointers, but are t/pe safe. <ele,ates allow methods to be passed as parameters. <ele,ates can be used to define callbac6 methods. <ele,ates can be chained to,ether* for example, multiple methods can be called on a sin,le e)ent. Consume WebSer)ice =sin, S$+: Introduction Web Ser)ices are thou,ht of as a means to pro)ide easil/ accessible ser)ices o)er a networ6. We can use ES.'E I<E to create a Web Ser)ice. While there are different techni7ues to communicate with a Web Ser)ices, S$+: is re,arded as the actual standard. S$+: messa,es are bein, sent to ser)ice endpoints. his can simpl/ be S$+: o)er & :. Information #e,ardin, Exsitin, Web Ser)ice .+smx file for that WebSer)ice 0=#L2. http.AAlocalhostA+dd'umbersASer)iceD.asmx WS<L =#L. http.AAlocalhostA+dd'umbersASer)iceD.asmx 3wsdl 'amespace of web ser)ice. http.AAlocalhostAwwwrootAaddnumbersASer)iceD %ethod. int +dd wo'umbers 0int, int2 Class. Ser)iceD Steps "or Consumin, Web Ser)ice =sin, S$+: Start a new +S:.'E web application. Install msxml.msi, then clic6 on K+dd reference K and then select KInterop.%S9%L?.dllL and clic6 on add. Bou can download the En,lish )ersion of the msxml.msi install file )ia this lin6. http.AAdownload.microsoft.comAdownloadAHAaAHAHaH?ca?e;4Mcc;1G@@;ab4G;bf4feaNHGaG5Amsxml4.msi. Create one label to displa/ result 0I< I lablelD2. <eclare ob89%L&ttp of t/pe %S9%L?.Ser)er9%L& :1@.
:rotected %S9%L?.Ser)er9%L&
:1@ ob89%L&ttp
<eclare one strin, strSoapEn)elope which contains soap re7uest. strin, strSoapEn)elopeI KL* Create S$+: En)elope strSoapEn)elope li6e this. strSoapEn)elope I -O3xml )ersionIP-D.@P- encodin,IP-utf;NP-3Q-* strSoapEn)elope JI -Osoap.En)elope -* strSoapEn)elope JI -xmlns.xsi I P-http.AAwww.w4.or,A?@@DA9%LSchema;instanceP- -* strSoapEn)elope JI -xmlns.xsdI P-http.AAwww.w4.or,A?@@DA9%LSchemaP- -* strSoapEn)elope JI -xmlns.soapI P-http.AAschemas.xmlsoap.or,AsoapAen)elopeAP-Q-* strSoapEn)elope JI -Osoap.Fod/Q-* strSoapEn)elope JI -O+dd wo'umbers xmlnsIP-http.AAlocalhostAwwwrootAaddnumbersASer)iceDP-Q-* strSoapEn)elope JI-OaQD@OAaQ-* strSoapEn)elope JI -ObQD?OAbQstrSoapEn)elope JI -OA+dd wo'umbers Q-* strSoapEn)elope JI -OAsoap.Fod/Q-* strSoapEn)elope JI -OAsoap.En)elopeQ-* Create an instance of Ser)er9%L& ob89%L&ttp I new Ser)er9%L& Set the header of S$+: re7uest. ob89%L&ttp.open0-:$S -, http.AADM?.DGN.N1.M@A+dd'umbersASer)iceD.asmx,false,--,--2 ob89%L&ttp.set#e7uest&eader0-Content; /pe-, -textAxml* charsetIutf;N-2* ob89%L&ttp.set#e7uest&eader0-S$+:+ction-, -http.AAlocalhostAwwwrootAaddnumbersASer)iceDA+dd wo'umbers-2* Send the S$+: re7uest. ob89%L&ttp.send0strSoapEn)elope. oStrin,022* Wait for some time. ob89%L&ttp.wait"or#esponse05@@2* a6e response in strin, out9%L. strin, out9%L I ob89%L&ttp.response ext. oStrin,02* <ispla/ result in label0I<I labelD2. LabelD. ext I out9%L. oStrin,02* :1@. :1@02*
What is 'ormaliRation3 'ormaliRation is the process of desi,nin, a data model to efficientl/ store data in a database <atabase normaliRation is a data desi,n and or,aniRation process applied to data structures based on rules that help buildin, relational databases. In relational database desi,n, the process of or,aniRin, data to minimiRe redundanc/ is called normaliRation. 'ormaliRation usuall/ in)ol)es di)idin, a database into two or more tables and definin, relationships between the tables. he ob8ecti)e is to isolate data so that additions, deletions, and modifications of a field can be made in 8ust one table and then propa,ated throu,h the rest of the database )ia the defined relationships. What are the <ifferent 'ormaliRation "orms3 D'" ; %a6e a separate table for each set of related attributes, and ,i)e each table a primar/ 6e/. Each field contains at most one )alue from its attribute domain. ?'" ;If an attribute depends on onl/ part of a multi;)alued 6e/, then remo)e it to a separate table. 4'" ;If attributes do not contribute to a description of the 6e/, then remo)e them to a separate table. +ll attributes must be directl/ dependent on the primar/ 6e/. #ules for 4'" o separate table for each set of related attributes, and ,i)e a primar/ 6e/ for each table. If an attribute depends on onl/ part of a multi;)alued 6e/, remo)e it to a separate table If attributes do not contribute to a description of the 6e/, remo)e them to a separate table. t/pes of ar,uments Ealue /pe and #eference /pe Call b/ Ealue S Ealue passed will ,et modified onl/ inside the function , and it returns the same )alue whate)er it is passed it into the function. Call b/ #eference S Ealue passed will ,et modified in both inside and outside the functions and it returns the same or different )alue. usin, S/stem* usin, S/stem.Collections.Teneric* usin, S/stem.Lin7* usin, S/stem. ext* namespace Eal#ef /pe U class :ro,ram U public )oid Ealue /peSW+:0strin, s,strin, sD2 U strin, temp I sD* sD I s* s I temp* Console.WriteLine0-Swapin, 'ame,Sur'ame. U@V UDV-, s, sD2* V public )oid #eference /peSW+:0ref strin, s,ref strin, sD2 U strin, temp I sD*
sD I s* s I temp* Console.WriteLine0-Swapin, 'ame,Sur'ame. U@V UDV-, s, sD2* V static )oid %ain0strin,WX ar,s2 U strin, name I -)inoth-* strin, fatname I -m/ilsam/-* Console.WriteLine0-$ri,inal 'ame,Sur'ame. U@V UDV-, name, fatname2* :ro,ram :ro I new :ro,ram02* :ro.Ealue /peSW+:0name, fatname2* Console.WriteLine0-Ealue /pe +fter Swaped 'ame,Sur'ame. U@V UDV-, name, fatname2* :ro.#eference /peSW+:0ref name, ref fatname2* Console.WriteLine0-#ef /pe +fter Swaped 'ame,Sur'ame. U@V UDV-, name, fatname2* Console.#eadKe/02* V V V What is +ssemblies and t/pes +ssemblies are two t/pes he/ are Shared assembl/ and pri)ate assembl/. shared assemblies are shared amon, multiple applications and the/ are stored in Tlobal +ssembl/ Cache. :ri)ate +ssemblies implies to a sin,le application and the/ are stored in the root director/ of the application. T+C. III T+C is used to store assemblies and to share them between multiple applications. I' the shared s/stem, the names of the assemblies should be uni7ue as it can be accessed b/ all applications. he newer )ersions of the component should also ha)e uni7ue names. hese can be achie)ed b/ usin, a stron, name for the assembl/. + shared assembl/ is placed in the T+C folder that is reser)ed for shared assemblies. T+C=til. IIIIIII Tlobal assemblies will be re,istered in C.PwindowsP+ssembl/ as T+C0Tlobal +ssembl/ Cache2 usin, a tool called T+C=til. $nce it is re,istered, an/ application can refer for that assembl/ to that path. Earl/ Findin, )s Late Findin, Earl/ Findin, Earl/ Findin, describes that compiler 6nows about what 6ind of ob8ect it is, what are all the methods and properties it contains. +s soon as /ou declared the ob8ect, .'E Intellisense will populate its
methods and properties on clic6 of the dot button. Late Findin, Late Findin, describes that compiler does not 6now what 6ind of ob8ect it is, what are all the methods and properties it contains. Bou ha)e to declare it as an ob8ect, later /ou need ,et the t/pe of the ob8ect, methods that are stored in it. E)er/thin, will be 6nown at the run time. <ifference +pplication will run faster in Earl/ bindin,, since no boxin, or unboxin, are done here. Easier to write the code in Earl/ bindin,, since the intellisense will be automaticall/ populated %inimal Errors in Earl/ bindin,, since the s/ntax is chec6ed durin, the compile time itself. Late bindin, would support in all 6ind of )ersions, since e)er/thin, is decided at the run time. %inimal Impact of code in future enhancements, if Late Findin, is used. :erformance will be code in earl/ bindin,.