October 2007 - Posts

UC Launch : Windows RTC Client API

UC = Unified Communication. Keep that in mind :).

Windows RTC Client API (that I will talk about in UC Launch) enables you to build applications that can make PC-PC, PC-phone, or phone-phone calls or create Instant Messaging (IM) sessions over the Internet. Both voice and video calls can be established on PC-PC calls. Presence information on a list of contacts is also supported. Application sharing and whiteboard can be added to enhance the communication capabilities of any type of session. Nice to have this great opportunity to introduce you this cool technology.


ISV can use the RTC API to build next generation applications that include real-time communication solutions for corporations. Huge opportunity in Indonesia for this type of application. Telco providers that want to sell RTC services can build their own client application with these APIs.

RTC Client API:
- Supports multiparty phone-phone calls
- Uses SIP-based signaling and presence communications
- Integrates with the Microsoft® Office RTC proxy and registrar server
- Supports provisioning with ITSPs or third-party corporate-deployed servers
- Integrates signals over IP and PSTN networks

We can use RTC SDK 1.2 / 1.3. But I prefer to show the latest 1.3.


Download Here : Windows Real-Time Communications Client API SDK 1.3

I hope version 1.3 is ready for Vista and VS 2008 but let see, I will let you know also. I have downloaded RTC SDK and maybe I should show the interop by generating type library with MIDL and TLBIMP.


Thx - RAM

Share this post: | | | |

My First Look on Project Astoria

Astoria is designed to facilitate the creation of flexible data services that are naturally integrated with the web. Users can use this data services with ASP.NET AJAX proxy. Astoria uses URIs to point to pieces of data and simple, well-known formats to represent that data, such as JSON and plain XML. Interesting thing is Astoria models the data exposed through the data service using ADO.NET Entity Data Model (EDM), an Entity-Relationship derivative as I posted before. You can read my previous post here and start learn ADO.NET EDM. Official information on Project Astoria please visit the Astoria web site at http://astoria.mslivelabs.com

Silverlight and Flash applications remove the option of a server-side rendering process that mixes data and code; code to drive the presentation aspects is pre-compiled and deployed as a single file in the web server. After reaching the client web browser the code calls back into to the web server to retrieve actual data to display within the user interface. Orthogonal to single-data source web applications and their architecture, a new class of application has also emerged on the web, called mashups.

Mashups are front-ends that aggregate and combine data that is available in a "pure data form" on the web – currently mostly are in the form of RSS/Atom feeds - and add value on top of the individual pieces of data.

What is Astoria?

Project Astoria consists of a combination of patterns, libraries and an online service that explores the concept of data services for the web. Currently, Astoria data services use relational databases as the underlying store, but in general the nature of the store does not surface in the Astoria interfaces. Currently Astoria can represent data in plain XML, JSON (JavaScript Object Notation) and in a subset of RDF+XML.

Mashups are an example of a new type of web application that, today, is basically stateless. While mashups have access to data across the entire internet, they can only consume that data. They cannot store their own data on the web (without a custom back-end service to do so). The Astoria online service offers just such a data source that can be combined with other external sources. A second example is internet-enabled desktop applications. These applications are not delivered through or executed inside a web browser, but still connect to the internet to retrieve and store data.

How to Start

Using the Astoria, web developers can create custom structured data stores on the web and access them from anywhere that they have internet access. These data services can then be the storage or data source for mashups, or the backing store for internet enabled applications, or be applied to any other scenario where a rich data service on the web is required, independently of where it is hosted. If you installed Astoria September CTP, you will get the following files at:


C:\Program Files\Microsoft Codename Astoria


There are 4 DLLs and one exe tool (ClientEDMGen.exe). Now, lets start do a simple data service from AdventureWorks sample database. Just follow my steps.

- Use VS 2008 and create a new ASP.NET Web Application, called it Astoria.
- Add new "ADO.NET Entity Data Model" point to AdventureWorks DB Employee table.
- Add new "Web Data Service" item and put the following codes in service code file

public class AdventureWorksDataService : WebDataService<AdventureWorksEntities>
{

}

Note : AdventureWorksEntities is the class name of AdventureWorks EDM.  

At this point your data service is ready to use. You can deploy it to IIS.



NOTE: current CTP defaults to “all access” to make it straightforward to experiment with the technology. In the future you can expect security-oriented defaults that don’t expose anything unless it has been explicitly enabled.

Keep exploring ADO.NET EDM and Astoria. You will get more improvement in very near future.

Thx - RAM

Share this post: | | | |

My First Look on ADO.NET Entity Framework

Yes!!! Finally I have time to look on this, "the Microsoft's solution for database oriented application". I strongly believe this is a cool stuff for LOB developers. No more NHibernate/IBatis/EntLib OR/M, no more SubSonic active record, cos as we  expected, Microsoft shipped it (now in Beta 2)!!.

What you will need to follow me in this post are:

- VS 2008 Beta 2 Installed on your machine (Get from PCMedia Magazine)
- ADO.NET Entity Framework installed
- ADO.NET Entity Framework Tools installed (with samples and docs)


If I said framework, you can imagine it as a collection of OO classes packaged for specific purpose. ADO.NET entity framework is also like that. It was implemented as two primary managed DLLs at the following location:

%Program Files%\Reference Assemblies\Microsoft\Framework\3.5

- System.Data.Entity.dll
- System.Data.EntityDesign.dll

Those two DLLs are members for .NET framework 3.5 and also we have their copies at GAC folder. ADO.NET Entity Tools gives us EDM Tools at :

%windir%\Microsoft.NET\Framework\v3.5\EdmGen.exe
%windir%\Microsoft.NET\Framework\v3.5\EdmxDeploy.exe

 

Why Do We Need More Framework?

Every LOB has, explicitly or implicitly, a conceptual data model that describes the various elements of the problem domain, as well as each element's structure, the relationships between each element, their constraints, and so on. We usually think and work with "objects in mind" at the beginning. But then, since currently most applications are written on top of relational databases, sooner or later our objects will have to deal with the data represented in a relational form. This is an impedance mismatch (the difficulty of one system to handle inputs from another system) between OO concept and relational storage.

Basically we can do LOB with "clean ADO.NET". I am totally agreed with that. But when we take a look at the amount of codes that average LOB developers must write to address the impedance mismatch across various data representations (for example objects and relational stores), it is clear that we need more standardize framework. Indeed, there are many enterprise scenarios where the right data access framework can empower developers to focus on the needs of the application, as opposed to the complexities of bridging disparate data representations. 


What is ADO.NET Entity Framework?

ADO.NET Entity Framework enables us to work with data in the form of domain-specific objects and properties, just say entities, without having to concern themselves with the underlying database tables and columns where this data is stored. It provides higher level of abstraction called Entity Data Model (EDM), and let me start with it.

EDM is an Entity-Relationship (ER) data model. This ER model is familiar to most if not all LOB developers, and has been used successfully for about 20-30 years. The key concepts introduced by the EDM is metadata. EDM metadata (*.edmx) defines data at both the relational (at storage) and conceptual level and a mapping between the two. It also enables us to program directly against the data types defined at the conceptual level as CLR objects. 

A longstanding and common design pattern for data modeling is the division of the data model into three parts: a conceptual model (ex : domain abstraction), a logical model (ex : ER diagram), and a physical model (ex : storage engine features). With Entity Framework you can write code that operates on conceptual entities and relationships, relying on the Entity Framework to map those operations to storage-specific relational commands. No more hard-coded dependencies on a particular RDMS engine or even a particular logical model.  With Entity Framework you will have consistent conceptual model across multiple storage engines. What we need to do is to create a conceptual entity data model, a storage entity model, and a mapping between the two. Those are what I called EDMX metadata which encapsulates the form of three types of XML files that have corresponding file name extensions:

- Conceptual Schema Definition Language (.csdl)
- Store Schema Definition Language (.ssdl)
- Mapping specification language (.msl)

Using EDM metadata, the Entity Framework generates a set of classes that programmers use to interact directly with the conceptual model and indirectly with the storage model and the underlying data store. These classes are partial classes that can be extended with additional members added by the developer. Cool !!!

How to Start ?

For INDC Geeks, just install VS2008, EDM Framework and Tools !!. The EDM Wizard starts after you add an ADO.NET Entity Data Model to any .NET 3.5 project in VS 2008. Follow the wizard for your 1st time use to generate an Entity Data Model (EDM) for database objects (Tables, Views, Stored Procedures, Functions). The wizard creates an .edmx which enables us to view and edit the mappings graphically then it creates a source code file that contains the classes generated from the CSDL information encapsulated in the .edmx file. The source code file (C#, VB.NET) is auto-generated and is updated when the .edmx file changes. 

  

Above picture is EDM for AdventureWorks sample database in SQL 2005. I got that by following these steps:

- Create Console Project in C#
- Add Reference to System.Data.Entity
- Add using System.Data.Objects in your code
- In solution explorer, add new item, ADO.NET Entity Data Model
- Follow the Wizard to generate EDM from AdventureWorks database
- In Database Object Form, choose Department and Employee tables
- Use LINQ to do query on EDM object
- Use VSTS 2008 Profiler to see module dependencies

using System;
using System.Linq;
using System.Data.Objects;
using AdventureWorksModel;

namespace EntityFramework
{
    class Program {
        static void Main(string[] args) {
            using (AdventureWorksEntitiesModel  db = new AdventureWorksEntitiesModel ())
            {
                var departments = from d in db.Department
                                where d.GroupName == "Research and Development"
                                orderby d.DepartmentID
                                select d;

                foreach (AdventureWorksModel.Department  x in departments) {
                    Console.WriteLine(x.Name);
                }
            }
            Console.ReadLine();
        }
    }
}

You can review how it works by doing profiling (instrumentation) for the resulted executable like I showed in the following picture.


Who is the man behind the scene ??? As you may guess, EDMGen.EXE !!! For you who are command line fanatics (anti-wizard), don't hesitate to use your fave XML editor and play with it:). For example: 

To generate a full Entity Model from the INDCDB sample database.

EdmGen /mode:FullGeneration /project:INDC /provider:System.Data.SqlClient
/connectionstring:"server=RISMAN-VISTA;uid=sa;pwd=xxxxx123;database=INDCDB"


To generate an Entity Model starting from an SSDL file.

EdmGen /mode:FromSSDLGeneration /inssdl:INDCDB.ssdl /project:INDC


To validate an Entity Model.

EdmGen /mode:ValidateArtifacts /inssdl:INDC.ssdl
/inmsl:INDC.msl /incsdl:INDC.csdl


Please explore the result of EdmGen /?  command line to foster your understanding about what behind the scene. I strongly recommend you to start with command line code generation instead of EDM Wizard. Let me show you in my next Entity Framework posting.

Happy coding !!


Thx - RAM

Share this post: | | | |

MSDN Day | WCF Deep Dive

For you who (not) attended to my MSDN Day WCF session, here you can download all slides:

WCF - Architecture
WCF - Contract
WCF - Binding
WCF - Security

For you who are interested to explore more, I also collected some additional WCF slides.  

WCF - Hosting 
WCF - Interop 
WCF - LOB Adapter
WCF - Security Features

On top of .NET 3.0 training kit that I posted before, I do suggest you to get and read MSDN library. I started my understanding from that documentation. I also recommend you to read at least one book to strengthen your fundamental knowledge. First time I learnt WCF from Programming Indigo by David Pallmann, then after finished that, I always consult to "Programming WCF Services by Juval Lowy". Those two books are helpful. 

Please note that "learning is not memorizing". Don't try to memorize all WCF attributes as we already have WCFSvcConfig editor in VS2008's Tools menu. With that tool, WCF is only about configuration. The most important things are distributed apps concepts and C# 2.0 language knowledge. :).

See you in my next MSDN, TechNet and Bina-ISV sessions. I hope you enjoy as I did!

Thx - RAM

Share this post: | | | |