Gilad Lavian's Blog

In Development

Browse by Tags

All Tags » VS 2008 (RSS)
Start Detached AddIn
This Addin add new option to the debug menu for each project (When right clicking from Solution Explorer). Features Starts a new instance for the selected project. In case the project is not executable, a dialog is popped asking the user what to do. Requirements Microsoft .NET Framework 2.0 Visual Studio 2008 For more information click here . Download Version 1.0.0
Build Error on empty lines in Post-build event command line
The following error message raised when trying to compile a Project with an empty line on the Post-build event command line: The empty line in the Post-build event command line: Resolving this problem is simply to delete the empty line in the Post-build event command line.
Code Snippet RW (Response.Write)
Code Snippet For Response.Write   Ok, this code snippet must be the oldest trick in the book, but still I think it will help to developers how doesn't know about it.   1. Create a file name rw.snippet 2. Copy this XML code and save it. 3. From the tools menu in VS, select "Code Snippets manager". 4. Select import, and point it to the saved file. 5. To use the snippet write rw in the code editor. 6. Enjoy!   <?xml version="1.0" encoding="utf-8" ...
LINQ To SQL - Performing Inner Join Queries
Its amazing how simple it is to create inner join queries with LINQ.   Assuming you have the AdventureWorks Database installed.   public void GetEmployeeByID( int employeeID) { AdventureWorksDataContext aw = new AdventureWorksDataContext(); aw.Log = Console.Out; var entities = from e in aw.Employees join ea in aw.EmployeeAddresses on e.EmployeeID equals ea.EmployeeID join a in aw.Addresses on ea.AddressID equals a.AddressID join c in aw.Contacts on e.ContactID equals c.ContactID where e...
LINQ To SQL - Get the SQL text query
Usually when we perform a LINQ Query on a SQL table, we don't see the actual query. Assuming you have the AdventureWorks Database installed. To see the query text, use the Log method: aw.Log = Console.Out   public List<Employee> GetEmployees() { AdventureWorksDataContext aw = new AdventureWorksDataContext(); var employees = from emps in aw.Employees select emps; aw.Log = Console.Out; return employees.ToList(); }   The result:
JOY, Visual Studio 2008 JavaScript Inteliscence Support
Yet, another great feature in Visual Studio 2008. JavaScript Inteliscence This is wonderful, i can finally write JavaScript prototypes and see them in the Inteliscence. It was so hard to write Object Oriented in VS2005 because of no Inteliscence support. To see this in action, first, I've created a new JS file called JScript.js, within i created a new class called Test(). Then i created 2 new prototypes function under Test() called DoSomthing1() and DoSomthing2(). Then i created a new instance...
LINQ - Handling Legacy Code
LINQ is for queries, no doubt about it. Yet - we can do some interesting thins with LINQ, and not just queries. For example, we all deal sometimes with legacy code inherited from some old project - so here some interesting ways to handle this code with few simple lambda expressions. For this example, I will use this Employee class: public class Employee { public Employee( string firstName) { this ._firstName = firstName; } private int _id; private string _firstName; private string _lastName; public...
WCF - IIS Integrated Security
Usually when we developing a WCF service in Intranet environment, we need to enable users to authenticate on IIS with there login credentials - Integrated Security.   Assuming we using basicHttpBinding and we host the service library on IIS web site, This can be accomplished by the following settings: < bindings > < basicHttpBinding > < binding name ="basicHttpBindingConfig" > < security mode ="TransportCredentialOnly" > < transport clientCredentialType...
WCF - Binding and Security
How do we know which binding to use and when? How do we know which security schema goes with our selected binding configuration?   There's allot of considerations with the binding configuration: Is there IIS involved. Are we going to use IIS Integrated Security. Are we going to use net.tcp binding?   There's also security issues we need to address: How we going to secure our services communication. Do we use the transport or the message layer.   Setting Features Transport Server...
LINQ to SQL Classes
One can only wish everybody to speak LINQ! The following solution demonstrate how to query database tables with object relational data classes. For this example you need to download and install the AdventureWorks Database provided by Microsoft. First, create a new console project: Open the "Server Explorer", click on the "Connect to Database" button: Select the Microsoft SQL Server: The next step is to connect to your AdventureWorks Database Server, from the "Add Connection"...