Josh-CO Dev

Solving the worlds problems one line of code at a time.


Leave a comment

LINQ in the Business Database World

I have come across two dilemmas lately in my professional career, the first of which is that I love LINQ. The second dilemma is that the way we do business does not provide us with much of a need for it. Really, these two aren’t dilemmas on their own, but combine the two and the problems begin to arise. All of our apps are generally just a front end to a database. We fetch data via a dataset and use this for all databinding and pass all CRUD operations through a webservice to call stored procs. With this type of a model, LINQ just isn’t that efficient unless you want to pull all of your data at once and then parse through your collection, which can be cumbersome on the initial load for a large table.

There is one place where I have found good use for LINQ, in batch jobs where I am pulling data from one source and posting it to another, particularly if I need to scour the data. Below is some LINQ code that I have used to take a dataset that I have pulled in from a source database, scour out any rows that have a null or <0 value, then return the results in a datatable. I tried this many other ways and LINQ was by far the fastest. This operation will run on over 100,000 records in mere seconds.

 

private DataTable scourDatasetLINQ(DataSet ds)

{

try

{

var results = from myRow in ds.Tables[“PIData”].AsEnumerable()

where myRow.Field<double?>(“value”) != null && myRow.Field<double?>(“value”) >= 0

select myRow;

 

DataTable dt = results.CopyToDataTable<DataRow>();

return dt;

}

catch (Exception ex)

{

LogExceptionToFile(“CEMSBatch”, ex, 30);

return null;

}

}


Leave a comment

Microsoft Live Meeting

So, how many people out there are really using Microsoft Live Meeting? Honestly, I find that I rarely need to use this type of technology, but when I do need it, it is amazing. Our team is spread out across two locations throughout the state and we often have to travel to other sites within the state. So when you have some sort of presentation to give, Live Meeting steps up as a great product to share a presentation. Where we will begin to use it tremendously is the developer learning program that I mentioned in my previous post. We will be performing live demos from within Visual Studio and need employees in remote locations to be able to see what we are doing as we are doing it. I’ve done a lot of desktop sharing before, but never any live coding, here’s to hoping this goes awesome!


Leave a comment

Developer Learning Programs

At my place of employment we tend to do things the old fashioned .NET way, think datasets. We have an outdated framework and an outdated knowledge-base. One of our biggest problems is that many of our developers simply do not keep up with current development trends, they tend to become comfortable in their jobs and not want to learn anything else voluntarily. To help combat this, we are beginning a developer learning program where we spend about 30 minutes every other week giving a presentation and demo on many newer topics. I will try to post some of this information here as we share it at work. Here is a list of our beginning topics:

Named Parameters

Optional Parameters

Dynamic keyword

Automatic properties

Anonymous type

Lambda

Linq  

XML

Metro

Metro style apps vs classic style apps

XAML

Silverlight and WPF

RIA

Inheritance

Interface development

XML Documenter

Debugging