Skip to main content

Posts

Showing posts from 2010

Introduction to ADO.Net Entity Framework 4

The ADO.Net Entity Framework 4 is an ORM (Object Relational Mapping) framework that allows developers to work with relational data as application specific objects, freeing us from the need to write the data access plumbing code. We us LINQ to query data and retrieve and manage data as strongly typed objects. EF also provides us with services like change tracking, lazy loading and query translation. It supports the development of data – oriented software applications. Features of Entity Framework 4 - Works with a variety of databases (SQL Server, Oracle, and DB2) Rich mapping engine to map application objects to database schema. Integrated Visual Studio tools to visually create models or to auto generate models from an existing database (EDM Generator and EDM Designer). Integrates well into any .net applications like asp.net, WPF and WCF. Programming model similar to ADO.Net since EF4 is built on top of existing ADO.Net provider model. Reduced development time. Application centric objec...

Workflow Foundation 4 - Part 3 - Data storage and management

This is my third post on WF4. First one was an introductory post on WF4 and in second one we focused on executing workflows. In the this post I am going to focus on the topic of data storage and management. Every business process or flow depends on data. When you think of data there are three elements to it as listed below - Variables - for storing data Arguments - for passing data Expressions - for manipulating data. Let us first look at the variables. Variables are storage locations for data. Variables are declared before using them just like in any other languages like C# or VB.Net. Variables are defined with a specific scope. When you create a variable in an activity the scope of the variable becomes that activity's scope. Variables can also have access modifiers like None, Mapped or ReadOnly. Let us look at an example where we will create two variables and assign a scope to them along with access modifiers. //Declare a sequence activitiy Sequence seqWf = new Sequence(); //de...

Workflow Foundation 4 - Part 2 - Executing workflows

In my introductory post I had focused on giving a brief overview of workflow foundation-4 highlighting what is new and how things have changed from 3.5 to 4. You can check this out here . This post will be a very simple one in which I am going to focus on how to execute workflows. Executing workflows is very simple in WF4. There are basically two approaches - Use WorkflowInvoker Use WorkflowApplication Using WorkflowInvoker is the simplest of the two approaches. Some of the disadvantages of this method are - You cannot persist the workflow instance You cannot unload or resume bookmarks You can execute the workflow synchronously or asynchronously both using WorkflowInvoker. To execute the workflow synchronously using the WorkflowInvoker you simply call its static method Invoke and pass the workflow object to it. Here is a simple example - Sequence seqWorkflow = new Sequence { Activities = { new WriteLine {Text = "Hello"}, new WriteLine {Text = "World using WorkflowInvoker...

Invalid Viewstate Problem

Recently I have been facing this problem of invalid viewstate. After googling a bit found some interesting concepts and solutions related to viewstate. So I thought let me just make a note of these references and have them handy. This is from the Microsoft Support highlihgting some techniques that you can use to debug / troubleshoot this problem - http://support.microsoft.com/?id=829743 This one is more interesting which highlights how you can get this problem while using Server.Transfer method, again from Microsoft Support - http://support.microsoft.com/kb/316920/ This one here is related to machineKey set to auto generate in machine.config http://forums.asp.net/p/1059371/1516632.aspx This one here is related to third party web site (running on different framework version) posting into your web site. http://blogs.msdn.com/tess/archive/2007/06/11/a-case-of-invalid-viewstate.aspx Hope all your invalid viewstate problems get taken care of with this. Here is the exception detail - Excepti...

Introduction to Workflow Foundation 4 (WF4)

I finally decided to pick-up my blogging once more. Since I have been trying to learn Windows Workflow Foundation 4 (WF4) I thought I might as well start off with this topic. WF4 is a development framework that enables you to create a workflow and embed it in a .Net application. It is neither an executable application nor a language. It provides a set of tools for declaring a workflow, activities to create your logic and to define control flow and a runtime for executing the resulting application definition. It also provides services for persistence of state, tracking and bookmarking. You can create your workflow directly in code, in mark-up or in a combination of both. Workflow provide us with two major advantages - Creating unified application logic. Making application logic scalable. Workflow Authoring styles - Sequential Workflow executes a set of contained activities in a sequential manner. Workflow Foundation was introduced in the .Net 3.0 and updated in 3.5. In .net 4 it has bee...