Showing posts with label c#. Show all posts
Showing posts with label c#. Show all posts

Thursday, December 26, 2013

LINQ to Entities CLR Methods Mapping

It's very useful to have this in mind when you write lambda expressions or use LINQ to Entities

For example, you can't compare GUID to string using ToString() Method in the lambda expression as ToString() Doesn't have a mapping, but you can use New GUID 

http://msdn.microsoft.com/en-us/library/bb738681(v=vs.110).aspx

Thursday, December 5, 2013

Useful Entity Framework Tutorials

It's rare to find a complete tutorials' series like W3Schools but this site make a great series for Entity Framework http://www.entityframeworktutorial.net/

Tuesday, October 8, 2013

Post to twitter programatically with 3 lines of Code!

  1. Create a new web application
  2. using Nuget manager, download/install Tweetsharp
  3. Create a twitter application by visiting https://dev.twitter.com/apps/new
  4. Go to your twitter app settings, and make sure it's a read/write app
  5. Go to "Reset Keys" tab and reset keys, so the permission of read/write works with the new keys
  6. Generate Access Token and the first tab in your twitter settings
  7. Write the following Code, *Replace Dashes with your app keys, from the previous steps
======================================
using TweetSharp;
        //Store Keys
        string consumerKey = "-------";
        string consumerSecret = "-------";
        string accessToken = "-------";
        string accessTokenSecret = "-------";
        //Authenticate with twitter as your app.
        var service = new TwitterService(consumerKey, consumerSecret);
        service.AuthenticateWith(accessToken, accessTokenSecret);
        //Post Tweet
        var status = service.SendTweet(new SendTweetOptions { Status = "My Second #Tweet from Code :D" });
======================================
-- You can use the status variable to know the id of you posted status etc.