My name is Edward Tanguay. I'm an American software and web developer living and working in Berlin, Germany.
9 hours ago: Here's a use-case for datapod format, recording human-readable data that later can be used as a datasource: http://is.gd/eSsLg @pholdings.
9 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global economy #fail.
10 hours ago: "Subscriptions are available to U.S. addresses only." http://www.highlights.com another global #fail.
11 hours ago: My notes on podcast with author Aimee Bender's Lemoncake book, "a normal kid punished by expectations of giftedness": http://is.gd/eSsLg.
12 hours ago: Interesting: "one page per book": http://openlibrary.org/about.
12 hours ago: Another after-work 8K, did 5K in 23:33, getting cooler here as #berlin #marathon approaches: http://is.gd/eSp95.
yesterday: C# CODE EXAMPLE: Extension method for checking regex in one line: http://is.gd/eQzyg.
yesterday: New podcast source: "I don't want to put you to sleep, but I want to be as rich, and rewarding, and resident as a dream.":http://is.gd/eQrdC.
yesterday: An intense colin marshall interview with michael silverblatt on the art of interviewing & more: http://is.gd/eQqve (search for "blatt").
yesterday: The stackexchange site for wordpress is up: get your answers / establish your reputation @cottonr http://wordpress.stackexchange.com.
2 days ago: "I've always felt that any time you can use a tuple, you should use a struct.": http://is.gd/eQm9V.
ENTITY HOWTO created on Tuesday, February 24, 2009 permalink
How to set up ADO.NET Entity Framework with SQL Server CE (SDF file) in a WPF application
This shows you the exact steps to create a WPF application with a SQL Server CE (i.e. used in mobile devices), an Entity Model, and display the contents of a database table in a WPF ListBox. If you use a normal SQL database file (MDF) it will be 2 MB without data, whereas a SDF file is about 85K.
Set Up Project and Database
  1. Make a new WPF project called TestEntity.
  2. Make a new directory called App_Data.
  3. Right-click App_Data directory and create a Local Database.
  4. Click Finish.
  5. Double-click on Main.sdf.
  6. Right-click on Tables and choose Create table.
  7. Type in Customers fields and set all necessary settings for ID field.
  8. Click OK.
Add Some Data
  1. Right-click on Customers table and choose Show Table Data.
  2. Type in some data.
Add the Entity Model
  1. Click on Solution Explorer.
  2. Make Model folder.
  3. Right-click, add, new item, ADO.NET Entity Model.
  4. Next, next, check the Customers table.
  5. Click Finish.
  6. Double-click on Main.edmx.
  7. Double-click on Main.sdf and drag the Customers table onto the MainDB.edmx window.
    NO_GRAPHIC: customImages/itemTypes/howtos/dragCustomers1.*
Bind Data To UI
  1. Double-click on Window1.xaml.
  2. replace the Grid element with this:
        <Window.Resources>
            <Style TargetType="{x:Type ListBoxItem}">
                <Setter Property="ContentTemplate" >
                    <Setter.Value>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <TextBlock>
                                    <TextBlock.Text>
                                        <MultiBinding    StringFormat="{}{1}, {0} ({2})">
                                            <Binding Path="FirstName"/>
                                            <Binding Path="LastName"/>
                                            <Binding Path="ID"/>
                                        </MultiBinding>
                                    </TextBlock.Text>
                                </TextBlock>
                            </StackPanel>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Window.Resources>
        <Grid>
            <ListBox x:Name="theCustomers"/>
        </Grid>
  3. Double-click on Window1.xaml.cs.
  4. add this Using:
    using TestEntity.Model;
  5. replace constructor with this:
            public Window1()
            {
                InitializeComponent();

                MainEntities db = new MainEntities();
                var customers = from c in db.Customers
                                select c;

                theCustomers.ItemsSource = customers;
            }