SQL Metal: No exclude table/view/sp functionality?

I like SQL Metal.  Anything that can save me time to write more app is good in my book.  I do find it extremely odd that I can't exclude tables/view/sp from it's DBML generation process.

After giving it a bit of thought, I figure I'll need to do a bit of work on #2

1. sqlmetal /database /dbml:my.dbml
2. run a clean utility to strip the dbml of tables/relationships that we're not interested in.
3. sqlmetal /code my.dbml

If I get this done anytime soon, I'll put it up on codeplex.

I still think perhaps in the next version of SQL Metal we'll see exclude flags anyway.

Food for thought: C# Extension Methods

Disclaimer, I have not tested any of the following code.

Write the following extension method:

public static int ToInt(this A a)
{
return Int32.Parse(a.ToString());
}

public class A
{
}
Now, say the class designer of A implemented it's own ToInt method.
public class A
{
public int ToInt(){ return 0; }
}

What happens now to the extension method?
My guess is that it would shadow the class method.


Now, assuming that the extension method shadows the class method, how could one access the class method in the extension method?

public static int ToInt(this A a)
{
return a.ToInt(); // infinite recursion?
}

Having different scope for your property

C# 2.0 gave us this:

private string _property;
public string Property
{
    get { return _property; }
    private set { _property = value; }
}

C# 3.0 gave us this:

public string Property
{
    get;
    private set;
}

Due to the rules of encapsulation, the accessor/getter usually has a more relaxed scope than the mutator/setter.

I've recently came across cases where the tables are turned.  Hurray for some dependency-injectioness!

[CreateNew]
IService MyService
{
   private get;
   internal set;
}

Love hate relationship with Asp:DropDownList.AppendDataBoundItems

Here's the deal.
I want to bind the dropdownlist to a List<Blob>.
But I want the dropdownlist to have an initial empty field.

Most people do this:

<asp:DropDownList ... EnableViewState="true" AppendDataBoundItems="true">
    <asp:ListItem Text="" Value="" />
</asp:DropDownList>

Which is nice and dandy, until you need to update the datasource of the dropdownlist.

AppendDataBoundItems will make sure all the current items stays in the list, and all the ones in the new datasource gets added to the list.

So you ended up writing silly code that looks like this:

string selectedValue = dropdownlist.SelectedValue;
dropdownlist.Items.Clear();
dropdownlist.Items.Add(new ListItem());
dropdownlist.DataSource= List<Blob>;
dropdownlist.DataBind();
dropdownlist.selectedValue = selectedValue;

 

I promise my next code rant will look a lot better than this rubbish!

New words

Went to a mandatory AGILE methodology meeting session currently being pushed by the client.  Personally I consider myself already sold on Agile methodologies, so feels somewhat that it was going to be a gigantic waste of time.  But it was mandatory, so to keep everyone happy, I went.

I went with a notebook, and just moments before the session, I had a brilliant idea of noting down any new words I'm about to learn that day:

spike-solution

We call it a deep-slice, but it's slightly different.  A spike solution is a focused technical effort to explore whether a technical design is actually possible or feasible.  In the particular Agile session it seems the spike solution is also a throw-away solution.  But I can see it being documented on a dev-wiki until it's used in implementation.

A spike-solution is good because it reduces risk - if an approach can not work, it is better to know early rather than later (say, after all the UI, database, etc have been designed).

re-engineering

It's like re-factoring, but not re-factoring.  It's re-engineering.  You can't engineer a business process, because it's business and not engineering.  But you can re-engineer a business process (I guess by applying engineering processes to a business procedure).

I consider this word a "rubbish word thrown-in to confuse people".