The blog has moved to a new address. The blog is now located at http://devintelligence.com

Monday, April 14, 2008

Visual LINQ Query Builder - VS 2008 Add-In

Visual Linq Query Builder helps you create Linq to SQL queries for your programs(Support  for C# and VB projects is provided) and demonstrates how to create their own Visual Studio 2008 add-in by using WPF.

 

Here are some screenshots of Visual Linq Query Builder in designer mode

clip_image016_2

clip_image018_2

Download Visual LINQ Query Builder and documentation

 

Technorati Tags: ,,

Sunday, March 16, 2008

JetBrains Omea goes Open Source

Great news for those of you who are interested in good blog reader

Jetbrains Omea - both source and companion files - is now distributed under GNU GPL v2 License http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

For technical details, visit the dedicated Confluence page: http://www.jetbrains.net/confluence/display/OMEA/this+link

 

Technorati Tags: ,,

Wednesday, March 12, 2008

System.Reflection - how to access and invoke private methods,fields or properties

For demonstration purpose I've created a class that contains only private methods,fields and properties

/// <summary>
/// Holds blog information
/// </summary>
public class Blog
{
/// <summary>
/// Gets the posts count.
/// </summary>
private static int PostsCount
{
get
{
return 10000;
}
}

/// <summary>
/// Gets the description.
/// </summary>
/// <returns></returns>
private string GetDescription()
{
return @"A weblog dedicated to obsessively profiling
reviewing new Internet products and companies"
;
}


/// <summary>
/// Changes the name of the blog.
/// </summary>
/// <param name="newName">The new name.</param>
private string ChangeBlogName(string newName)
{
name = newName;
return name;
}


string url = "http://techcrunch.com";
string name = "Tech Crunch";
}



 



To access private fields I used the System.Reflection.FieldInfo class .For private properties I used System.Reflection.PropertyInfo .Note if you want to work with private members you should use System.Reflection.BindingFlags enum as shown in the example below .So for non-static class members the flags should looks like BindingFlags.NonPublic | BindingFlags.Instance .For static don't forget to add BindingFlags.Static .




class Program
{
static void Main(string[] args)
{



Blog blog = new Blog();
Type type = typeof(Blog);
//create reflection bindings - will be used to retrive private fields,methods or properties
BindingFlags privateBindings = BindingFlags.NonPublic | BindingFlags.Instance;

// retrive private fields from our class
FieldInfo[] fieldInfos = type.GetFields(privateBindings);

// retrive private fields metadata
foreach (FieldInfo fieldInfo in fieldInfos)
{
Console.WriteLine(fieldInfo.Name +" "+ fieldInfo.GetValue(blog));
}


PropertyInfo [] propertyInfos = type.GetProperties(privateBindings|BindingFlags.Static);
// retrive private static properties metadata
foreach (PropertyInfo propertyInfo in propertyInfos)
{
// note that no instance need for static property to retrive it's value
Console.WriteLine(propertyInfo.Name + " " + propertyInfo.GetValue(null,null) );
}

// call method using MethodInfo object
MethodInfo miGetDescription = type.GetMethod("GetDescription", privateBindings);
object retObj = miGetDescription.Invoke(blog, new object[]{});
Console.WriteLine(retObj);

// call method using MethodInfo object with input parameters
MethodInfo miChangeBlogName = type.GetMethod("ChangeBlogName", privateBindings);
retObj = miChangeBlogName.Invoke(blog, new object[] { "Yahoo blog" });
Console.WriteLine(retObj);

Console.ReadLine();



}



 



The console output fallows



image



Technorati Tags: ,,

Tuesday, February 26, 2008

Microsoft® Visual Studio Team System 2008 Database Edition Power Tools

Microsoft Visual Studio Team System 2008 Database Edition Power Tools is a set of enhancements and tools that complement and improve the user experience of VSTS Database Edition 2008

Features
• ChecksumCondition – You can use this test condition to verify that the checksum of the data set returned by a database unit test matches the checksum of an expected data set.
• ExpectedSchemaTestCondition – You can use this test condition to verify that the column names and data types of the returned data set match expected values.
Data Generator Improvements
• New Data Generator Wizard – This new wizard creates a data generation plan that is configured to copy data from a source database. You can use this wizard when you need to copy most of your data from a live source, but need to make small changes to ensure privacy.
MSBuild Task Improvements
• SqlAnalysis Task – You can use this build task to run T-SQL Static Code Analysis from MSBuild.
TSQL Static Code Analysis
• Static Code Analysis - A precursor to the functionality that will be in future versions of VSTS that will allow you to perform Static Code Analysis on T-SQL code.
Refactoring
• “Move Schema” Refactoring - Allows a user to right click on an object and move it to a different but existing schema
• SP Rename Generation - Generate a new script that will contain sp_renames for all rename refactored objects that the user can then execute.
• Wildcard Expansion - Automatically expand the wildcard in a select to the appropriate columns.
• Fully-Qualified Name Support - Automatically inject fully-qualified names when absent in a script
• Refactoring extended to Dataset - Refactor into strongly typed dataset definitions
MSBuild Tasks
• Data / Schema Compare Build Tasks - MSBuild tasks that can generate scripts as if the user had run the Data / Schema compare UI
Schema View
• API Access to Schema View - Insert / Update / Delete to schema View and list schema objects and their associated files
Dependency Tool Window
• Dependency Tree - Show the dependencies ( incoming / outgoing ) for selected schema objects in a new tool window
Miscellaneous Tools
• Script Preprocessor - Expand SQLCMD variables and include files and command line version (sqlspp.exe) & an MSBuild version ( wraps the command line version )

 

Download Microsoft® Visual Studio Team System 2008 Database Edition Power Tools

 

 

Technorati Tags: ,,,

Sunday, January 13, 2008

LINQ to Objects - 3 basic examples

 

The examples below show how you can use aggregate operators in "LINQ to Objects"

// our test data array
string[] names = { "Sara", "Bill", "Alex", "Don", "Tom", "David", "Dana" };

// Find names starts with with character 'D'
int namesStartsWithD = names.Count( name => name.StartsWith("d",
StringComparison.CurrentCultureIgnoreCase ) );
Console.WriteLine("There are {0} names that start with character 'D' in the name list.",
namesStartsWithD);

// Find the longest name
int longestName = names.Max( name=>name.Length );
Console.WriteLine("The longest name is {0} characters long.", longestName);


// Find the first name that starts with character 'D'
string firstStartsWithD = names.First(name => name.StartsWith("d",
StringComparison.CurrentCultureIgnoreCase) );
Console.WriteLine("The first name that start with 'D' - {0}.", firstStartsWithD);



image

Wednesday, October 10, 2007

SVN via MS IIS

SVN-IIS gives access to Subversion via MS IIS
The main goal of this project is to make a direct interface from a SVN repository to WebDav interface running on MS IIS.

Features

  • Practically no overhead
  • Tested on IIS5.x and IIS6.x
  • Tested on http and https (used a test certificate)
  • Support for HTTP 1.1 Chunked encoding
  • Runs on Windows XP\2000\2003\Vista
  • Apache like logging

Prerequisites

  • .NET Framework
  • Access from the IIS to a running Apache webserver, interfacing a SVN repository

 

[Via dotnetkicks.com]

Wednesday, September 19, 2007

Expression Blend 2 September Preview

Expression Blend 2 September Preview is available for download

New features

  • Visual Studio 2008 Beta 2 Support
  • Making Controls from Existing Objects
  • Split View and XAML Editor Improvements
  • Storyboard Picker
  • Storyboard and Keyframe Properties
  • Vertex Animation
  • Breadcrumb Bar
  • Font Embedding and Subsetting
  • Build Options
  • Object Manipulation

More details available at the Expression Team's blog.

Visit the Expression Blend 2 September Preview to download and install the latest build.