16 April 2013

ASP.NET, SQL, ADO.NET Video Tutorial

ASP.NET, SQL, ADO.NET Video Tutorial

Friend , Below link is really useful for Beginners

ASP.NET Gridview Video Tutorial

http://www.youtube.com/playlist?list=PL6n9fhu94yhW1NryGv6LxX4U4b07T4RlI


ADO.NET Tutorial for Beginner

http://www.youtube.com/playlist?list=PL6n9fhu94yhX5dzHunAI2t4kE0kOuv4D7

ASP.NET Tutorial for Beginner

http://www.youtube.com/playlist?list=PL6n9fhu94yhXQS_p1i-HLIftB9Y7Vnxlo


SQL Tutorial for Beginner

http://www.youtube.com/playlist?list=PL08903FB7ACA1C2FB

Dotnet Tutorial for Beginner

http://www.youtube.com/playlist?list=PL8598C97BA1D871C1

C# Tutorial for Beginner

http://www.youtube.com/playlist?list=PLAC325451207E3105


Uses of WCF


Uses of WCF


Interoperability
When our application is in .Net technologies and when the partner application was in another platform [J2EE]. It is running different operating system.[Different Platform]. The security requirement is also quite different. So to Interoperability with this application WCF play a key role in interoperable with the application

Unification of Microsoft’s Distributed Computing Technologies, WCF vs. other technologies
1.     ASMX, also called ASP.NET Web Services, would be an option for communicating with the Java EE-based reservation application and with the partner applications.

 WCF  - WCF can communicate using SOAP-based Web services, interoperability with
other platforms that also support SOAP

2.     .NET Remoting - Remoting is designed expressly for .NET-to-.NET communication, so it would offer the best performance for this situation.

 WCF - To allow optimal performance when both parties in a communication are built on WCF,  the wire encoding used in this case is an optimized binary version of SOAP.

3.     Enterprise Services - managing object lifetimes and defining distributed transactions. But it supports only limited set of protocols.

WCF - Managing object lifetimes, defining distributed transactions, and other aspects of
Enterprise Services are also provided by WCF.


4.     Web Services Enhancements (WSE) - might be used along with ASMX to communicate, Because it implements more advanced SOAP-based standards, known collectively as the WS-*specifications, WSE can allow better security.
         
WCF -  it supports a large set of the WS-* specifications, WCF helps provide reliability,
security, and transactions when communicating with any platform that also supports these
Specifications.

5.     System.Messaging, which provides a programming interface to Microsoft MessageQueuing (MSMQ) could be used to communicate with Windows-based partner applications.
          
WCF – It has option for queued messaging, built on MSMQ, allows applications to use
Persistent queuing without needing to use another application programming interface.

6.     System.Net developers can create applications that use the HTTP-based communication style known as Representational State Transfer (REST).

WCF - It has built-in support for creating RESTful clients and services. 
           Rather than requiring different technologies for different communication styles, WCF provides a single unified solution.

12 April 2013

IQueryable and IEnumerable

 IQueryable and  IEnumerable

The IQueryable interface is derived from IEnumerable

IEnumerable

1. IEnumerable exists in System.Collections Namespace.
2. IEnumerable can move forward only over a collection, it can’t move backward and between the items.
3. IEnumerable is best to query data from in-memory collections like List, Array etc.
4. While query data from database, IEnumerable execute select query on server side, load data in-memory on client side and then filter data.
5. IEnumerable is suitable for LINQ to Object and LINQ to XML queries.
6. IEnumerable supports deferred execution.
7. IEnumerable doesn’t supports custom query.
8. IEnumerable doesn’t support lazy loading. Hence not suitable for paging like scenarios.
9. Extension methods supports by IEnumerable takes functional objects.

IEnumerable Example

 MyDataContext dc = new MyDataContext ();
IEnumerable< Employee > list = dc.Employees.Where(p = > p.Name.StartsWith("S"));
list = list.Take< Employee >(10); 
Generated SQL statements of above query will be :
 SELECT [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0]
WHERE [t0].[EmpName] LIKE @p0
Notice that in this query "top 10" is missing since IEnumerable filters records on client side



IQueryable
1. IQueryable exists in System.Linq Namespace.
2. IQueryable can move forward only over a collection, it can’t move backward and between the items.
3. IQueryable is best to query data from out-memory (like remote database, service) collections.
4. While query data from database, IQueryable execute select query on server side with all filters.
5. IQueryable is suitable for LINQ to SQL queries.
6.IQueryable supports deferred execution.
7. IQueryable supports custom query using CreateQuery and Execute methods.
8. IQueryable support lazy loading. Hence it is suitable for paging like scenarios.
9. Extension methods supports by IEnumerable takes expression objects means expression tree.

IQueryable Example
MyDataContext dc = new MyDataContext ();
IQueryable< Employee > list = dc.Employees.Where(p => p.Name.StartsWith("S"));

list = list.Take< Employee >(10); 
Generated SQL statements of above query will be :SELECT TOP 10 [t0].[EmpID], [t0].[EmpName], [t0].[Salary] FROM [Employee] AS [t0]WHERE [t0].[EmpName] LIKE @p0
Notice that in this query "top 10" is exist since IQueryable executes query in SQL server with all filters.





4 April 2013

Difference between PostBackTrigger and AsyncPostBackTrigger in ASP.NET

 Difference between PostBackTrigger and AsyncPostBackTrigger in ASP.NET


Specifies a control and event that will cause a partial page update for the UpdatePanel that contains this trigger reference.
Specifies a control and event that will cause a full page update (a full page refresh). This tag can be used to force a full refresh when a control would otherwise trigger partial rendering.

PostBackTrigger

Use the PostBackTrigger control to enable controls inside an UpdatePanel to cause a postback.


Uses of AsyncPostBackTrigger
  • For controls that are outside a panel.
  • For controls that are inside a panel when the ChildrenAsTriggers property is false.
  • For controls that are inside nested panels, in order to cause a refresh of parent panels.

28 March 2013

Multiple File Upload JQuery Asp.net

Multiple File Upload JQuery Asp.net in C#

MultipleFileUpload.aspx.cs


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultipleFileUpload.aspx.cs"
    Inherits="MultipleFileUploadJquery.MultipleFileUpload" %>

Include the below script

    < script src="Scripts/jquery-1.8.2.js" type="text/javascript">
    < script src="Scripts/jquery.MultiFile.js" type="text/javascript">

Code

    < form id="form1" runat="server">
    < div >
       
         < asp:FileUpload ID="file_upload" class="multi" runat="server"  / >
        < asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" / >
        < asp:Label ID="lblMessage" runat="server" / >
       
    < /div >
    < /form >
< /body >
< /html >


MultipleFileUploadJquery,aspx.cs

using System;
using System.IO;
using System.Web;

namespace MultipleFileUploadJquery
{
    public partial class MultipleFileUpload : System.Web.UI.Page
    {  

        protected void btnUpload_Click(object sender, EventArgs e)
        {
            HttpFileCollection fileCollection = Request.Files;
            for (int i = 0; i < fileCollection.Count; i++)
            {
                HttpPostedFile uploadfile = fileCollection[i];
                string fileName = Path.GetFileName(uploadfile.FileName);
                if (uploadfile.ContentLength > 0)
                {
                    uploadfile.SaveAs(Server.MapPath("~/UploadFiles/") + fileName);
                    lblMessage.Text += fileName +""+ "Saved Successfully";
                }
            }
        }

    }
}


Multifile upload Code in C# Visual Studio 2010 are in the following path

http://sdrv.ms/103livW







23 March 2013

Saving Changes Is Not Permitted On SQL Server 2008 Management Studio.


Saving Changes Is Not Permitted On SQL Server 2008 Management Studio. 

Saving changes is not permitted occurs when doing alter table (table structure is changed):
Change data type on existing columns
Or change allow nulls on existing columns
 
To allow you to save changes after you alter table, do disable prevent changes:
 
1.Open Microsoft SQL Server Management Studio 2008
2.Click Tools, then click Options
3.Click Designers
4.Uncheck prevent saving changes that require table re-creation
5.Click OK
6. Try to alter your table


10 March 2013

OOPS Object Oriented Programming FAQ

OOPS  -  Object Oriented Programming  FAQ

Four main principles of OOPS
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction

1. Encapsulation
- Encapsulation is the process of hiding the irrelevant information and showing only relevant information to                  the user.
- Encapsulation is the process of wrapping up of data and member in a class.

Example:
- Only specific method or properties can access the private member of class.
- Data Hiding through the private class access specifier.

Uses:
-Increase the maintainability of the code by showing only relevant information to the User.


2. Abstraction
- Abstraction is the process of hiding the details and exposing only the essential feature of particular concept or object.

Real time example:
Refrigerator:
The process of showing the general information related to the refrigerator is called Abstraction and hiding the complex information from the user is Encapsulation.


3.Inheritance
- Inheritance is the process through which a child class obtain the feature defined its parent class.
- Used for reuse of code and eliminate redundant code.

Types:
- Single, Multilevel, Multiple and Hierarchical.

4.Polymorphism
- One Interface multiple methods
- With the help of Polymorphism we can use one procedure in many ways based on our requirement.

Method Overloading:
-Method according to number and types of parameter.

Operator Overloading:
-Change the functionality of operator.

Runtime Polymorphism
Overriding
-Overriding is the feature that allows derived class to provide a specific implementation of a method that is already provided its base class.

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...