Entity Atoms Flex Edition released

On April 10, 2012, in C#, Programming, RIA, by Akash Kava

We are happy to announce release of Entity Atoms Flex Edition, which provides client frameworks and tools for ASP.NET MVC and RIA Services to access Entity Framework on any mobile platforms.

Microsoft’s latest Entity Framework makes it very easy to setup complex transactional applications. However in order to extend Change Set, Authorization and Audit controls to all mobile platforms Entity Atoms was designed.

Currently, only Flex Edition is available for download, Flex Edition lets you create Flex Mobile application that can execute on any mobile platform.

We are going to release new native framework and tools for major mobile platforms very soon.

Key Highlights

  • Extend Entity Framework to all platforms using RIA Services
  • Simple LINQ Expression Rules to enable Security
  • Enable Table Audits/History including Cascade Delete
  • Customizable Code Generator (Flex, Android, C#, VB.net)
  • Simple Client and Server side validations
  • Easy Access to related entities (navigation properties)
  • JSON Endpoint with Date Handling
  • Additional UI Elements for Flex Mobile
  • Advanced Search (Search navigation properties)
  • Full ChangeSet management at Client Side
  • Unit Of Work pattern at Client Side

System Requirements

  • Windows 7, Windows Vista Service Pack 2,Windows XP Professional.
  • Microsoft .NET Framework 4.0 and above.
  • Microsoft Visual Studio 2010
  • Flash Builder 4.6
  • MS SQL Express 2005 onwards or MySQL or Oracle

Click here to Download Free Demo

Tagged with:  

Entity Framework and RIA Services do not allow Entities to be added/removed from cross containers. In order to move Entity from one DomainContext/ObjectContext to another DomainContext/ObjectContext, we need to recursively detach the object graph and attach it to other DomainContext/ObjectContext.

Object Graph

Single entity can be easily detached and attached from EntitySet where it belongs, but the problem comes when navigation properties of entity are not empty. Entity object along with navigation properties is called Object Graph because if you notice, navigation property’s navigation property will contain reference to same entity and that will result in endless recursive code for Detach/Attach.

An entity with the same identity already exists in the EntitySet

When you try to detach entity from old DomainContext/ObjectContext and attach it to DomainContext/ObjectContext, it may give you an error that entity with same identity already exists and it will throw an exception. In this case we will just simply reuse the existing entity instead of attaching the entity we have.

Entity cannot be attached to this EntityContainer because it is already attached to another EntityContainer

In case of ObjectGraph, your root level entity is already detached, but navigation properties are not detached, and while you try to attach your root level entity, it will throw same error for entities that exist in navigation properties.  Because detach method does not recursively detach every entity from navigation properties.

Attach/Detach Extension Methods

Finally after brainstorming little, I made following class that will allow you to recursively detach/attach object graphs from DomainContext. You can replace DomainContext to ObjectContext to use it inside Entity Framework.

DomainContext Extensions
  1. /// <summary>
  2. /// DomainContext Extensions
  3. /// </summary>
  4. public static class DomainContextExtensions {
  6.     /// <summary>
  7.     /// Recursively Attaches entity loaded from Other DomainContext to
  8.     /// current specified DomainContext
  9.     /// </summary>
  10.     /// <param name="context">DomainContext where entity will be attached</param>
  11.     /// <param name="entity">Entity loaded from other DomainContext</param>
  12.     /// <returns></returns>
  13.     public static Entity Attach(this DomainContext context, Entity entity)
  14.     {
  15.         if (entity == null || entity.EntityState != EntityState.Detached)
  16.             return entity;
  18.         Entity newEntity = entity;
  20.         Entity[] list = new Entity[] { entity };
  21.         foreach (Entity c in context.EntityContainer.LoadEntities(list,
  22.             LoadBehavior.MergeIntoCurrent))
  23.         {
  24.             newEntity = c;
  25.             break;
  26.         }
  28.         // recursively attach all entities..
  29.         Type entityType = typeof(Entity);
  31.         // get all navigation properties…
  32.         Type type = entity.GetType();
  33.         foreach (var item in type.GetProperties())
  34.         {
  35.             if (entityType.IsAssignableFrom(item.PropertyType))
  36.             {
  37.                 Entity navEntity = Attach(context, item.GetValue(entity, null)
  38.                     as Entity);
  39.                 item.SetValue(newEntity,navEntity, null);
  40.                 continue;
  41.             }
  42.             if (item.PropertyType.Name.StartsWith("EntityCollection"))
  43.             {
  44.                 IEnumerable coll = item.GetValue(entity, null) as IEnumerable;
  45.                 List<Entity> newList = new List<Entity>();
  46.                 foreach (Entity child in coll)
  47.                 {
  48.                     newList.Add(Attach(context, child));
  49.                 }
  50.                 dynamic dcoll = item.GetValue(newEntity,null);
  51.                 foreach (dynamic child in newList)
  52.                 {
  53.                     dcoll.Add(child);
  54.                 }
  55.             }
  56.         }
  57.         return newEntity;
  58.     }
  60.     /// <summary>
  61.     /// Recursively detaches entities from DomainContext, this
  62.     /// method detaches every navigation properties
  63.     /// of current Entity as well.
  64.     /// </summary>
  65.     /// <param name="context"></param>
  66.     /// <param name="entity"></param>
  67.     public static void Detach(this DomainContext context, Entity entity)
  68.     {
  69.         if (entity == null || entity.EntityState == EntityState.Detached)
  70.             return;
  71.         EntitySet nes = context.EntityContainer.GetEntitySet(entity.GetType());
  72.         nes.Detach(entity);
  74.         Type entityType = typeof(Entity);
  76.         // get all navigation properties…
  77.         Type type = entity.GetType();
  78.         foreach (var item in type.GetProperties())
  79.         {
  80.             if (entityType.IsAssignableFrom(item.PropertyType))
  81.             {
  82.                 Detach(context,item.GetValue(entity, null) as Entity);
  83.                 continue;
  84.             }
  85.             if (item.PropertyType.Name.StartsWith("EntityCollection"))
  86.             {
  87.                 IEnumerable coll = item.GetValue(entity, null) as IEnumerable;
  88.                 foreach (Entity child in coll)
  89.                 {
  90.                     Detach(context,child);
  91.                 }
  92.             }
  93.         }
  94.     }
  96. }

Tagged with:  

Looking at the innovation driving inside Silverlight, it is getting more attention then the former WPF. However having very similar syntax and .NET as base platform, both WPF and Silverlight are very different in approach, design and use. Today lot of developers live in dilemma of WPF vs Silverlight and it has now become a great trade off as similar to speed vs size.

Lets compare the need and features of both and make the trade off very easy to understand.

History of Microsoft Development Platform

We all loved Visual Basic, what did it provide? a rapid development platform to make quick business applications. By business applications I mean, the one to track your purchases, your activities which are just probably relational database and reports. Business Application makers didn’t have to worry about device drivers, system services, hardware and component versions.

Visual Basic provided very thin layer of application development for rapid turnaround time of small scale but huge in demand business applications. These applications require very less programming language expertise but more of business expertise. But it had limitations, you could not create a huge resource intensive application like CAD programs, Media editing programs, servers, games etc.

On other hand we had Visual C++, a huge development framework with possibility to do almost everything that was possible on Windows Operating System. Where you could fulfill need of any program, be it CAD, games, media editing, or servers etc.

But the development time required was very high, performance was great and the intelligence required to create system applications was very high. Getting talent to build such applications weren’t easy and even it is not easy today, because you need real in depth knowledge of how every part of the system functions. There is more dependency upon device drivers, component versions and there was no drag and drop.

Apart from any other platforms existed so far, Microsoft clearly and distinctly divided development into two major categories. Rapid vs System, or Native vs Thin applications.

Evolution of .NET

Ever since c# came into existence, we started seeing quick shift from tedious MFC/COM/ATL to c#, because all technologies were simply extension of c/c++ and each needed separate runtime to exist. Even still today, some of my components are written in ATL/COM and compiling them in newer version of Visual Studio is always pain. Compilation time is huge.

Where else, .NET based project took less time to compile, even the 1.0 versions are still in use and still in good shape.

Earlier it was expected that it will only replace the Visual Basic segment of programming, but somehow all devs started liking it and preferred it as an alternative to ATL/COM/MFC as its native capability and speed provided easy development and quick turnaround.

Windows Forms did provide an alternative to Visual Basic. But there was lack of more powerful, GUI interface in .NET. So came WPF. Not only this, .NET being neutral, the compiled apps are independent of 32 bit or 64 bit platforms.

Windows Presentation Framework

As we clearly see, Microsoft has its plan to make WPF as its primary GUI framework against all Win32 components. WPF is very easy to write as it is very simple XML, XML is very easy to read, and its very easy to organize, even the editors and compilers need less overhead in parsing and taking decisions based on XML.

The challenge here was to imitate almost everything that existed in Win32 inside WPF, and WPF became very feature rich, but once again it requires more intelligence to write complicated and big applications. Having talent already expert in HTML+JS area, and transforming them into WPF talent was little difficult.

Plus the way WPF was built, it was built more tight coupled with system operating system, just like the way MFC/ATL/COM were built. But WPF is very fast and very rich in features. It is now possible to write CAD, games and such high performance applications in WPF which can utilize latest hardware technologies.

And it is exact alternative for COM/ATL/MFC today.


Realizing that converting HTML+JS and Visual Basic devs to WPF was more challenging, silverlight pop in to existence, Which is very light weight, a smaller counterpart of WPF, although the syntax remains same, the ability to develop apps are limited in silverlight as it is not very tightly coupled with operating system.

However, you can develop apps pretty fast, but only focused on business logic, which here is one step ahead amongst all being platform independent. The devs are not required to have in depth knowledge of system, nor silverlight are more dependent on hardware, resources or other components.

But you cant develop high performance apps like CAD, games and media editing apps.

Indeed, it is an exact alternative for Visual Basic.


You need to choose WPF when you are creating any application of following type,

  1. Interfaces with custom hardware.
  2. You need to control memory and control the performance of app.
  3. Create application that requires very high memory, CAD programs etc.
  4. Connect to system components and used to manage system, hardware.
  5. Want to connect to native system via COM/DLL interfaces.
  6. Media (Audio/Video/Picture) editing applications.
  7. Where your target audience can download and install .NET platform easily.

However you can use Silverlight for following alternative type of applications,

  1. Provides smooth and quick animation on the web.
  2. Make Rapid Business Applications, which can connect to your enterprise apps.
  3. Make typical CRUD applications.
  4. Registration, Dashboard type of applications.
  5. Lightweight gaming and interaction websites.
  6. Run in browser, with very small installation needed.

Coming Up:

UI Atoms from NeuroSpeech, a set of controls to develop rapid business applications on both WPF as well as Silverlight. A true alternative for DataForm on Silverlight and WPF, to have unified coding for Business Apps. Please click here to check the preview.

Tagged with:  


Apple announces iPad, a bigger version of iPod Touch. With a big screen of 1024×786 pixels. And it comes with basic need of surfing internet and be online. So called magical and revolutionary device does not support Flash and Silverlight yet. And most of business apps today, built upon RIA are running either on Flash or on Silverlight. And IT Devs are heavily investing in RIA technologies due to snail speed of WWW group. However, the device can replace a laptop for most of users who just spend time on internet doing their regular business, studies or entertainment. So lets analyze what will be future of Web for different type of users.


Today students need a good web browser and an internet with lot of social media websites to study, interact, entertain and play games. Apple iPad is a best bet for students. Do they really care that it does not support Flash and Silverlight yet? Answer is no. They will certainly buy iPad, come to the website, and if it has Flash or Silverlight, they will call website’s support instead of Apple’s support and say,

Your website is not working on my iPad.

Sales Reps and Business Owners

Looking at the cost, and attractive looks, Sales Reps and Business Owners will buy iPad because they usually do not type anything great whole day, all they do is, look at websites, present demos (which are powerpoint or keynote), and access their office through online business portals. For all these purpose they will be very happy with iPad. However, once they come to your business app through online portal, they cant see Flash or Silverlight, they are not going to call apple support. They will call IT devs and say,

What the hell IT devs are doing, cant they make our business app work on iPad?

Independent Professionals

Independent professionals like Doctors, Lawyers, Photographers, Actors .. anyone who probably does not sit in front of PC for more then 2 hours a day, will certainly like to get rid of big laptop bag with 4-10 external wires and device connectors. All what they do mostly is, check their emails, surf the websites, fill simple forms on some business web apps and which they can do it on iPad. Today iPad may not have great drawing tools but some professional apps on App store will certainly provide capability of tagging, drawing and marking tools needed by these professionals. Today lot of business applications are on Flash and new ones are coming on silverlight. But iPad will not support !! , once again, they will pickup the phone to vendor and say,

Your website is not working on my iPad.

Who needs any of following?

pc_vs_macClerks,  Graphics/Media artist and IT Developers, which comprises of small part of computer users. Because their applications and workspace requires bigger screens and multiple devices, connectivity and computing performance. Apple’s iPad will be useful only to test the business apps and for other entertainment to this group.

It seems iPad will spread in Home Entertainment, Education and Independent Professional sectors very fast because of low cost solution. And that will shake the developer community.

Troubles for IT Devs

  1. Current investment in Flex or Silverlight is at stake, as usage of mobile devices is increasing heavily, supporting business apps on these devices will not be possible until device OS creators, Adobe or Microsoft work towards supporting RIA technologies.
  2. Silverlight/Flex are heavy and costly to run on battery based devices, they will consume more cpu and battery to create consumption problems.
  3. Rewriting apps in light HTML5 is a big challenge, training, planning and supporting all existing modules will be a big pain. However looks like World Wide Web Consortium (W3C) has been sleeping for 10 years to create features of RIA required today. Need of consumers were high, that created innovations like DHTML, Flash and Silverlight, and the problem was, W3C never observed in market what consumers (Internet users) really need.
  4. Even if you decide to invest heavily on iMac and decide to make apps that can run on iPad, your Apps are at mercy of Apple Employee doing approval, here is the funny process.


Death of Free and Open Internet

IT Devs will slowly loose the independence over distributing apps against open free internet distribution. Today any release, distribution of media (song, movie, play) etc are controlled by major Labels.

If The  Intelligence will be controlled by major Labels in IT with narrow route to success by Apple, Google, Microsoft etc giants, then the growth we saw in last decade in IT industry will slow down very rapidly and independent innovators will become slaves to major labels.

Will Bubble of RIA Burst now?

Once again, just like Dot Com, if RIA (Flex/Silverlight) Bubble bursts and all IT Devs will be blamed again.

Tagged with:  

RIA – Why? Which One? How?

On December 13, 2008, in RIA, by Akash Kava

RIA (Rich Internet Application) means faster means to develop light applications to fit in your business presentation and few quick interactive applications. With RIA you can not make a money tree and you can not become rich.

Target Applications:

  1. Frontend Applications
  2. Small Quick Demo Applications
  3. Graphical Analysis of MIS
  4. Marketing Presentations
  5. Quick Forms/Data Entry for Mass Audience
  6. Polls, Social Interaction Applications
  7. Thin Client Applications

With RIA you can generally make a thin client applications, which surely needs to interact with high poerful web server or any other form of server over internet. RIA replaces frontend for modern internet applications from traditional HTML/JS form processing websites.


Traditional web portal applications (ASP.NET/EJB..) takes too much of time to process every single request, as it does not use full potential of client side computer. Every decision of which button to be displayed, state of an application and user’s choices and preferences, everything is maintained on server and applications utilizes too much of bandwidth as well.

Thats why, RIA is simple step to differentiate user interface and business logic completely with implementations of standards like SOAP web services and REST apis.

All RIAs are compiled at development site, that means the final RIA is in form of an application, which will execute accurately as designed. However in traditional HTML+JS, if any part of HTML is not rendered properly or its coded wrongly, there is no way to detect until it is delivered to browser and some error has been encountered. Pre compilation on RIA, reduces time required to develop web application drastically.


Flex Silverlight JavaFX XUL
Vendor Adobe Microsoft Sun Microsystems Mozilla
Open Source Yes
(I am talking about FLEX not Flash)
No Yes Yes

Community Support is very bad when you need quick solution in an emergency.

Paid Support & Community Paid Support & Community Community Support Community Support
Dependency Flash Player Silverlight Player Java Runtime + JavaFX Runtime XUL Runtime

According to various statistics, the by default availability of dependent software on PCs.

95% 10% 0%

Although few PCs and all MACs have Java Runtime, they still need something additional.

30% as FireFox supports XUL Apps
Size of Runtime 1MB 4.5MB 30MB 4MB
Native Device Access Camera, Mic and Speakers Speakers Speakers None in Web App,

May be few in Desktop App

Audio Video Support Widely used FLV and MP3 format, stable and its there since 2001 WMV/WMA/WMA Pro No No
Converters for the Supported Video FFMPEG and many other commercial vendors available Paid Encoders No No
Documentation SDK Documentation and Samples MSDN but still very premature, (Reason, the learning curve is little higher) JavaDocs but JavaFX is still new Apache Documentation, very scattered, difficult to learn.
Syntax XML + Action Script XML + C# / JS / VB.NET Totally New Syntax XML + JS
Language Feature Strictly Typed with “Object” being dynamic type Strictly Typed,

Dynamic type to come in C# 4.0

Strictly Typed Dynamic Typed
Binding Expressions

Flex introduced wonderful concept of auto updating expressions when properties or variables changes.

Very Accurate Accurate but lengthy code Available Better then JavaFX and Silverlight
Two Way Databinding
Not Available, Coming up in Flex 4 Available - Available
Binding Declaration Simple Attribute Extra Code in each bindable property Extra code in each bindable property Simple Attribute
Reflection Available Available Available Available
Code Size Very Concise Even simpler things like validator etc takes 6 lines, too big code size to maintain Size is small, but very disorganized, difficult to read Concise enough
Platform Availability Windows, Mac, Linux Windows Only Windows, Mac, Linux Windows, Mac, Linux
Stability Very Stable Pre Beta Pre Beta Stable Enough
Control Library Rich set of Controls available, plus lots of free stuff available as well Very basic controls, you have to spend money on other ISVs to get good controls Good set of Controls Almost everything is free, lacks good documentation though
Coders Availability

For project managers, how difficult it will be to find coders who will code.

Easily Available as existing Flash, HTML, JS, ActionScript can code. C# and Microsoft Technology programmers can code. Java Programmers can code, but due to new syntax, its still difficult to get hands on it. Very difficult as it requires too extra knowledge of mozilla architecture and various standards, which is not taught anywhere.
Commercial Training

Starting project is very easy, but ongoing maintanence and meeting deadlines requires excellent knowledge of technology, which you should not rely on community blogs, because time required to search any solution is costly.

Excellent Excellent Training available Where?
Threading Support No Limited No Limited
Themes/Skinning Yes Yes, but size of code is very big No Yes
WebService Integration Yes Yes Yes but very frustrating Yes
Upload/Download The Best Feature in Flex Yes Yes Yes
Installable on Desktop Yes No Yes Yes
Database Support (in desktop app only) Sqlite Not Applicable JavaDB

Too heavy and too slow

Auto Update on Desktop App Yes No No Yes
Present Since 2001 2007 2007 2001

Plugins are available under eclipse and netbeans etc type of editor, but problem is they are so premature, they dont support refractoring, analysis, debugging and lots of other facilities.

Flex Builder Visual Studio Plugin Plugin
IDE Cost
IDE Refractoring Yes Yes No No
IDE Source Versioning CVS

Good for Multiusers

Source Safe (Single Developer only)/ TSS (too costly) Plugin Plugin
Drag and Drop Editor Yes Limited, because to script you need Visual Studio and to design you need Blend (Other paid software) No No
Code Intellisense (Auto Complete) Yes Yes
Project Management Yes Yes
Library Management

Creating and importing shared code in the form of libraries.

Yes Yes
Component Development Very Simple Quite Complex as it is divided in User/Custom controls categories. Available Simple
The Result
Leader of RIA Flex Follower The Last Linux Love

Important Note:

Silverlight claims to be platform independent, but reality is, Microsoft no longer provides any more upgrades of Silverlight version for any other operating system other then Windows. And Linux was already not officially supported by Microsoft.

Advantages of RIA

  1. Reduce Development time
    As compared with traditional web application, since RIAs are pre compiled, errors due to syntax, wrong spellings can be detected earlier at time of desiging.
  2. Load First, Run Throughout
    RIAs load entire application (Except XUL) in the beginning, instead of HTML+JS, which loads as things proceed. This means, either application will load completely and work accurately even with slower bandwidth connection, or if some part didnt load, it will straightway display an error. So it works like transaction, either all or nothing. HTML+JS can behave unexpectedly in case of missing components.
  3. Seperate Design and Development Processes
    Flex and Sliverlight offers complete seperation of Development and Designing keeping integration simple, other platforms (earlier web ones) require too much time integrating designs and process.
  4. Utilize Client Computing
    Almost every computer has high powerful graphics capabilities, HTML/JS doesnt offer any great benefit over it. RIAs can completely explore native graphics capabilities and you get wide range of user interface functionality.
Tagged with: