Naweed Akram's Blog
<sharing: Knowledge />
Windows 8/RT WebAuthenticationBroker view issue - Alternative

Doing oAuth in Windows 8 couldn’t have been any easier and simpler. Remember the old days of getting Access Tokens from providers such as Yammer, GitHub, Facebook, 500px etc. (you name it). You had to use browser windows, passing URLs, manage the state etc. Windows 8 make it as simple as the code below to do all the underlying work for you. All you have to do is use the WebAuthenticationBroker, which presents the oAuth dialog, manages user authorization and state, and returns the access token, all with a few lines of code (3-4 lines).


However, there is a small issue. Some oAuth site present login/authorization dialogs which exceed the area displayed by WebAuthenticationBroker. This post addresses the problem and provides an alternative.

More ...
Tags:  .NET,  C#,  Silverlight Viewed:  26448       Comments:  9      

XGENO.DBMapper - A new way of OR/DB Mapping

XGENO.DBMapper is a simple, easy-to-use and powerful OR Mapper (just 15KB) for your database queries. It is set of extension methods (on the SQL Connection), which execute a SQL query (simple, parameterized, stored procs etc.) and return the data as a list of .NET objects (classes that you have created).


Note: This is not a replacement for existing ORMs (Linq/NHibernate/XGENO.ORM etc.). This is useful when there are lots of stored procedures or dynamic SQL queries are involved, and performance is a critical factor.

More ...
Tags:  .NET,  C#,  VB.NET,  ASP.NET,  MVC,  Silverlight,  ORM Viewed:  6153       Comments:  1      

Descriptive Value for Enums in C#

Consider a scenario that you have the following enum declared, which is used to define SQL operations (keeping it very simple):

    public enum Operands


Now, if the user wants to convert the enums to values that SQL server can understand (=, <>, <, > etc.), the following needs to be done:

            string _opValue = "";
            Operands _op = Operands.LessThan;

            switch (_op)
                case Operands.Equals:
                    _opValue = "=";
                case Operands.GreaterThan:
                    _opValue = ">";
                case Operands.LessThan:
                    _opValue = "<";
                case Operands.NotEquals:
                    _opValue = "<>";


Not very convenient. What if, you could say:


            Operands _op = Operands.LessThan;

More ...
Tags:  .NET,  C# Viewed:  5975       Comments:  0      

BuzzWitter - Google Buzz to Twitter

Not so recently (some 8 new moons ago), a colleague of mine approached me with a strange request. He is a heavy user of Twitter (based on latest statistics of 3,000 tweets till date and 300 followers). Anyways, with the launch of Google Buzz, he got very excited about it (since it is not limited to just 140 characters and allows rich text and media) and wanted a utility to automatically tweet his Buzzes (saving him the effort to post twice, once on Buzz and then on Twitter). This utility is a result of that request.

More ...
Tags:  .NET Viewed:  3545       Comments:  0      

Introducing XGENO.ORM v.2.0

XGENO.ORM v.2.0 is a simple and easy to use high performant ORM tool for use with .NET 4.0 based projects (Win Forms, ASP.NET, WPF, Silverlight 3.0) against Microsoft SQL Server 2005/2008.


Consider a simple table structure as below:

Table Name: tb_Users

cod_UserName nvarchar(50) PRIMARY KEY
txt_FullName nvarchar(200)
txt_EmailAddress nvarchar(50)
dat_DateOfBirth datetime
num_Dependents int


Wouldn't it be just convenient, if you could do this:


User _user = new User();

_user.UserName = “naweed”;
_user.FullName = “Naweed Akram”;
_user.EmailAddress = “”;
_user.dOB = new DateTime(1976, 9, 6);
_user.Dependents = 3;

_user.Save(); //To save the newly created user

More ...
Tags:  .NET,  ORM Viewed:  3474       Comments:  0      

RSS Feed

Quick Links