Friday, September 17, 2010

How to pass DateTime object from .Net to Flex using json

I have a wcf rest service in .net that needs to serialize an object to json that has a DateTime property and send it back to my flex application.

Friday, September 10, 2010

How to get the generated sql query sending to server by entity framework

This is a sample linq query in EF,
for example, we have 2 tables:
Contents, Tags (one to many, each content has zero or more tags)

Saturday, September 4, 2010

Consuming .Net WCF Rest in different ways

There are different ways to consume wcf rest services in .net, The basic idea is first creating the http request and include the message body and message header. we need to serialize the objects we are going to send, then we need to send the request and then get the response and deserialize to get the response objects.

Saturday, August 28, 2010

Wrapped BodyStyle in WCF Rest

I m going to explain the difference between BodyStyle = WebMessageBodyStyle.Bare and BodyStyle = WebMessageBodyStyle.Wrapped in WCF Rest Services.
Bare can only support one parameter that is not included in the TemplateUri but Wrapped can support multiple parameters and have some extra XML tags in the body.
I m going to show you an example:

Saturday, August 21, 2010

How to load assembly and its references ignoring version number using Reflection

I want to load an assembly A.BC.dll that has a reference to A.XZ.dll and I dont care about the version number for A.BNM.dll, these two assemblies are located in a /ref folder.

Saturday, July 31, 2010

Translate<T> method in ObjectContext in Entity Framework 4

In Entity Framework 4, ObjectContext has a nice Translate<T> method. This method will materialize the result type. It takes your DbDataReader and materializes the data back into entities, the T can be a primitive type, an entity type, or any custom type you like, That type does not have to be defined in the Entity Framework conceptual model.

LINQ Join in Entity Framework 4

I want to explain a simple linq join in entity framework 4.

Thursday, July 29, 2010

How to install the latest Flex SDK into Flex builder 3

Installing the latest flex SDK into flex builder 3 is pretty simple. after you download the new version of SDK from Adobe website, then unzip that zip file and copy the content to a new folder created on a location
like C:\Program Files\Adobe\Flex Builder 3\sdks or any location you like, But I prefer that location.
From the main menu, select Window > Preferences > Flex > Installed SDKs and click Add to add a your new sdk and you can select the default SDK you want Flex builder to use to compile your program.
Cheers!

Wednesday, July 28, 2010

How to get only date part in T-sql DateTime

SELECT DATEADD(D, 0, DATEDIFF(D, 0, GETDATE()))

OR

SELECT CONVERT(DATETIME, FLOOR( CONVERT(FLOAT, GETDATE())))