Friday, May 20, 2011

OAuth - simple as this diagram!

OAuth (Open Authentication) is an open standard for authorization. It allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site, desktop or mobile application without having to hand out their credentials, typically username and password.(http://en.wikipedia.org/wiki/OAuth)


OAuth sequence diagram
from
http://www.sitepen.com/blog/2009/02/19/introducing-oauth-in-dojox/

Friday, March 25, 2011

EntityFramework IQueryable ToTraceString

For old generated EDMX way this extension method might help:
        public static string ToTraceString<T>(this IQueryable<T> t)
        {
            // try to cast to ObjectQuery<T>
            ObjectQuery<T> oqt = t as ObjectQuery<T>;
            if (oqt != null)
                return oqt.ToTraceString();
            return string.Empty;
        }

For new EF 4.0 + way you will just have to invoke IQueryable<T> .ToString():
                IQueryable<Customer> query = db.Customers.Where(c=> c.CustomerName.Contains("a")).AsQueryable();
                Console.WriteLine(query.ToString());

Simple! Just like that!