WCF RIA Services – Getting Started

Overview:

In order to build business application using Silverlight , you may have to work with a lot of data. And that data is usually not resident on the client machine, it is usually distributed amongst many clients and this data is stored and operated on by back-end services.

WCF RIA (Rich Internet Applications) Services is a new part of the .NET 4 and Silverlight 4 frameworks that lets you quickly and easily build N-Tier Silverlight applications by providing framework components, tools, and services that make the application logic on the server available to the RIA Services client without requiring you to manually duplicate the programming logic.

On the server side, WCF RIA Services helps you define your services, domain entities, and supporting logic. On the client side, WCF RIA Services code generates corresponding classes that let you easily call those services, have the same entities available and populated on the client side,

The figure below shows what part of your architecture WCF RIA Services focuses on.

Image

 

In WCF RIA Service we must be aware of the following key concepts to begin build our

Project Links: A link between a Silverlight client project and a server web application or class library. The server project defines or references the domain services, entities, metadata, and shared code defined on the server side. As a result of the link, appropriate code is generated in the client project at compile time.

WCF Domain Services – This is the core construct of WCF RIA Services. A domain service defines the operations supported on the server side. These operations are exposed automatically via WCF and can be called from the client generated code without needing to know much at all about WCF, yhe WCF Domain Service encapsulate the business logic of a WCF RIA Services application. A domain service exposes a set of related operations in the form of a service layer. When you define a domain service, you specify the data operations that are permitted through this domain service.

Domain Context : This is the client side counterpart to the domain service. It is generated code on the client side that gives you easy access to the functionality that resides on the server side. Internally it contains a WCF proxy that makes the service calls, and it also manages creating the queries that get executed on the server side.

When you create a new Domain Service & build your project, you’ll notice a Domain Context class has been generated for you on the client one for each Domain Service. If you create a Domain Service named MyDomainService, you’ll get a generated Domain Context on your client named MyDomainContext, which inherits from the DomainContext class. It contains query operations to fetch data, collections of the entities you’re exposing through the Domain Service, submit and reject operations, … It provides a lot of functionality to help you with change tracking & interacting with the Domain Service.

the figure below is figuring out how the wcf domain service and domain context interact:

 

Image

 

DomainDataSource – This is a data source object that can be used to execute queries and submit changes to the server side. It gets associated with the domain context and makes calls through that domain context on your behalf to query and update entities. It facilitate direct data binding from XAML or can be used behind the scenes as well.

 

Image

In this article, I covered the basic concepts behind a WCF RIA Services application, we must be aware of these key concepts to start building our WCF Ria services applications.

Stay tuned for the next article , we are panning to build an n-tier application using WCF Ria Service on Silverlight 4.

 

 

Conclusion for the second ASP.Net Session

At the second ASP.Net session we talked about the ASP.net controls .

Web Server Controls , HTML Controls and User Controls

Web Server Controls :

ASP.NET Web server controls are objects on ASP.NET Web pages that run when the page is requested and that render markup to a browser.

In web server controls we talked about the standard toolbox controls like : textbox , buttons and lables , Also the validation and Login control

HTML Controls :

HTML elements in ASP.NET files are, by default, treated as text. To make these elements programmable, add a runat=”server” attribute to the HTML element. This attribute indicates that the element should be treated as a server control.

User Control :

A user control is a kind of composite control that works much like an ASP.NET Web page—you can add existing Web server controls and markup to a user control

Here’s the last session presenation ASP.net_Session2

ASP.Net Presentation “the first session”

this is the presentation that I made for the first ASP.Net session asp.net

Conclusion for the first AsP.net Session (Session 1)

this is a conclusion for my first ASP.net Online Session that I gave this Saturday ..
we Talk about the concept of web development , web development usually refers to the main non-design aspects of building web sites writing markup and coding .
also we refered to the differance between the windows application and web applications .. windows application :
If you don’t know what is a ‘Windows Application’, probably you have never seen a computer. Almost any application you see on a desktop computer is called ‘Windows Application’.

It is also called ‘desktop applications’ since they are mostly used in desktop computers.
Some common examples of desktop applications are:
1. Paint Brush program
2. Calculator program
Web application :
web application is also called ‘web site’. A web site is a collection of web pages hosted on a special computer called ‘web server
So what is the concept of web server ???
A Web server is a software program which serves web pages to web users (browsers).

A web server delivers requested web pages to users who enter the URL in a web browser. Every computer on the Internet that contains a web site must have a web server program.

The computer in which a web server program runs is also usually called a “web server”. So, the term “web server” is used to represent both the server program and the computer in which the server program runs.
Characteristics of web servers

A web server computer is just like any other computer. The basic characteristics of web servers are:

– It is always connected to the internet so that clients can access the web pages hosted by the web server.
– It has an application called ‘web server’ running always.

Web Server is a hardware or a software ?

From the above definition, you must have landed up in confusion “Web server is a hardware or a software”

Mostly, Web server refers to the software program, which serves the clients request. But as we mentioned earlier, the computer in which the web server program is also called ‘web server”.
which means web browser ???
Browser is an application, which helps us to view the Web sites and the web content.

Web sites are located in some remote systems, which needs a special kind of program or an application to access them, such an application is called browser.

A browser is an application which you can use to retrieve web pages from web sites and view.

When you type a URL in the browser, the browser will convert it into a web request which web server can understand. Browser will send the request to web server using the HTTP protocol.
NOW … How web applications work ?
when you type the web page address (URL) in a browser.
For example, consider this page: http://www.facebook.com/HelwanMicrosoftTechClub
This URL has 3 parts:
The protocol – http:
The server name – http://www.facebook.com
The file name – HelwanMicrosoftTechclub

2. Browser communicates with a computer in internet called ‘Domain Name Server’ to find out the IP Address of the server (Eg: http://www.aspspider.com).
3. Browser established a connection to the web server at that IP Address.
4. Server composes a ‘Request’ for the specified URL and sends the request to the web server to which it has established a connection.
5. The web server identifies the type of the page requested. If it is an asp.net web page, then browser knows that needs some processing by the asp.net service running as part of the web server. The request is handed over to the asp.net service. The asp.net service processes the asp.net page and generates the html output.
6. Web server sends the requested page to the browser.
7. When a response is received by the browser, it displays the web page to the user who typed the URL.
Finally … What is ASP.NET ?
– ASP.NET is the name of the Microsoft technology used for web site development.
– ASP.NET is NOT a programming language like C# or VB.NET
– ASP.NET development requires a programming language like C# or VB.NET to write code.
– ASP stands for Active Server Pages.
this is what we said in a brief .. I’ll Post here the link of the demo ASAP .
Waiting You at the Second session 🙂

Generics

Generics are the most powerful feature of C# 2.0. Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code
Advantages of Generics

In the earlier versions, before .NET 2.0, generalization was accomplished by casting types to and from the universal base type System.Object. Generics provide a solution to this limitation in the common language runtime and the C# language. This limitation can be demonstrated with the help of the ArrayList collection class from the .NET Framework base class library. ArrayList is a highly convenient collection class that can be used without any modifications to store any reference or value type.
Before Generics:

ArrayList list1 = new ArrayList();
list1.Add(3);
list1.Add(105);
//…

ArrayList list2 = new ArrayList();
list2.Add(“First item.”);
list2.Add(“Second item”);

But this convenience comes at a cost. Any reference or value type that is added to an ArrayList is implicitly typecast to System.Object. If the items are value types, they must be boxed when added to the list, and unboxed when they are retrieved. The casting, boxing and unboxing operations degrade performance; the effect of boxing and unboxing can be quite significant in scenarios where you must iterate through large collections.
So, what we need is, flexibility of the ArrayList but it should be more efficient and should provide some ways of type checking by the compiler, without sacrificing on the reusability of that class with different data types. An ArrayList with a type parameter? That is precisely what generics provide. Generics would eliminate the need for all items to be type cast to Object and would also enable the compiler to do some type checking.

In the generic List collection, in System.Collections.Generic namespace, the same operation of adding items to the collection looks like this:

List list1 = new List();
list1.Add(3); // No boxing, no casting

list1.Add(“First item”); // Compile-time error

This Presentation is about Generics .. it’s simple way to learn.Generics

Getting start with Microsoft web matrix

Microsoft web matrix is a web development tool that you can easily develop asp.net web pages , web applications , web sites.

to build your first application :

To begin, you'll create a new website and a simple web page.
1. Start WebMatrix
2. Click Site From Template. Templates include prebuilt
 files and pages for different types of websites.
3. Select Empty Site and name the new site HelloWorld.
4. Click OK. WebMatrix creates and opens the new site.
5. Select the Files workspace. This workspace lets you
 work with files and folders. The left pane shows you
 the file structure of your site.
6. In the ribbon, click New and then click New File…. 7. Select CSHTML, and in the Name box, type HelloWorld.
cshtml. A CSHTML page is a special type of page in 
WebMatrix that can contain the usual contents of a 
web page, such as HTML and JavaScript code, and that can
 also contain code for programming web pages.
8. Click OK. WebMatrix creates the page and opens it in
 the editor
9. Add the following highlighted HTML and content to the
 page:
<!DOCTYPE html>
<html>
<head> <title>Hello World Page</title>
</head>
<body> <h1>Hello World Page</h1> <p>Hello World!</p>
</body>
</html>
10. In the Quick Access Toolbar, click Save
11. In the ribbon, click Run.

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!