Tuesday, January 8, 2013

Some Imp Question



The BeginExecuteReader(...) and EndExecuteReader...() are for performing the
ExecuteReader(...) method asynchronously. If you use ExecuteReader(...)
your thread is blocked while that method executes.

Using BeginExecuteReader(...) (and the corresponding EndExecuteReader(...))
ExecuteReader(...) will be executed in a seperate thread, allowing for
yours to continue processing. The BeginExecuteReader(...) method will
require a callback method, and in that callback method, you will make a
call to EndExecuteReader(...) to end the asynchronous operation, and
retreive the return value.
Correlated subquery
Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value 
 from the row selected by the outer query.
Correlated subquery follows down to top approach i.e., main query is executed first(even though parenthesis       
 are present) and then child query. 
We can also say:In a subquery.
Example:
 select e1.empname, e1.basicsal, e1.deptno from emp e1
 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno)
Nested subquery
Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the 
 outer query row.
We can also say: in a Correlated subquery,Inner query condition is used in the outer query.
Nested subquery follows top-down approach i.e., child query is executed first and then parent .
Outer query condition is used in the the inner query.
Example:
 select empname, basicsal, deptno from emp
 where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno)


Thread

Threads share the address space of the process that created it.
Threads have direct access to the data segment of its process.
Threads can directly communicate with other threads of its process.
Threads have almost no overhead.
New threads are easily created.
Threads can exercise considerable control over threads of the same process
Changes to the main thread (cancellation, priority change, etc.) may affect the behavior of the other threads of the process.

Process

Processes have their own address.
Processes have their own copy of the data segment of the parent process.
Processes must use inter-process communication to communicate with sibling processes.
Processes have considerable overhead.
New processes require duplication of the parent process.
Processes can only exercise control over child processes.
Changes to the parent process does not affect child process.

The BeginExecuteReader(...) and EndExecuteReader...() are for performing the
ExecuteReader(...) method asynchronously. If you use ExecuteReader(...)
your thread is blocked while that method executes.

Using BeginExecuteReader(...) (and the corresponding EndExecuteReader(...))
ExecuteReader(...) will be executed in a seperate thread, allowing for
yours to continue processing. The BeginExecuteReader(...) method will
require a callback method, and in that callback method, you will make a
call to EndExecuteReader(...) to end the asynchronous operation, and
retreive the return value.
Correlated subquery
Correlated subquery runs once for each row selected by the outer query. It contains a reference to a value 
 from the row selected by the outer query.
Correlated subquery follows down to top approach i.e., main query is executed first(even though parenthesis       
 are present) and then child query. 
We can also say:In a subquery.
Example:
 select e1.empname, e1.basicsal, e1.deptno from emp e1
 where e1.basicsal = (select max(basicsal) from emp e2 where e2.deptno = e1.deptno)


Nested subquery
Nested subquery runs only once for the entire nesting (outer) query. It does not contain any reference to the 
 outer query row.
We can also say: in a Correlated subquery,Inner query condition is used in the outer query.
Nested subquery follows top-down approach i.e., child query is executed first and then parent .
Outer query condition is used in the the inner query.
Example:
 select empname, basicsal, deptno from emp
 where (deptno, basicsal) in (select deptno, max(basicsal) from emp group by deptno)

============================================================================
Trace:
This class works only when your application build defines the symbol TRACE.
For tracing, you have to use Trace.WriteLine statements.
Trace class is generally used to trace the execution during deployment of the application.
Trace class works in both debug mode as well as release mode.
Performance analysis can be done using Trace class.
Trace runs in a thread that is different from the Main Thread.
Trace is used during Testing Phase and Optimization Phase of different releases.

Debug:
This class works only when your application build defines the symbol DEBUG.
For debug, you have to use Debug.WriteLine statements.
You generally use debug classes at the time of development of application.
Debug class works only in debug mode.
Performance analysis cannot be done using Debug class.
Debug runs in the same thread in which your code executes.
Debug is used during Debugging Phase.

Web service:
The File extension of web service is .asmx.
It can be hosted in IIS.
[WebService] attribute has to be added to the class.
[WebMethod] attribute represents the method exposed to client.
One-way, Request- Response are the different operations supported in web service.
System.Xml.serialization name space is used for serialization.
XML 1.0, MTOM(
Message Transmission Optimization Mechanism), DIME, Custom.
Hash Table cannot be serialized.
Only public properties/fields can be serialized.
Unhandled Exceptions returns to the client as SOAP faults.
Slower than WCF.
Uses only SOAP(Simple Object Access Protocol).

WCF:
The file extension of WCF service is .svc.
It can be hosted in IIS, windows
 activation service, Self-hosting, Windows service.
[ServiceContraact] attribute has to be added to the class.
[OperationContract] attribute represents the method exposed to client.
One-Way, Request-Response, Duplex are different type of operations supported in WCF.
System.Runtime.Serialization namespace is used for serialization.
XML 1.0, MTOM, Binary, Custom.
The DataContractSerializer translate the
 Hash table into the XML.
Public/
Private properties/fields can be serialized.
Better than WebService. The performance measures in terms of xml serialization.
It can send/receive
 message in any transport protocol message format. By default it uses SOAP for communication.

The WHERE clause selects rows before grouping. The HAVING clause selects rows after grouping.
The WHERE clause cannot contain aggregate functions. The HAVING clause can contain aggregate functions.

A HAVING clause is like a WHERE clause, but applies only to groups as a whole, whereas the WHERE clause applies to
 individual rows. A query can contain both a WHERE clause and a HAVING clause. The WHERE clause is applied first to the individual rows in the tables . Only the rows that meet the conditions in the WHERE clause are grouped. The HAVING clause is then applied to the rows in the result set.

No comments:

Post a Comment

Implementing Service Locator (To Resolve Dependency)

using System; /// <summary> /// Summary description for Class1 /// </summary> public class serviceLocator {     public s...