Click here to Skip to main content
15,890,690 members
Home / Discussions / C#
   

C#

 
QuestionCreating token for a web service Pin
eso0o11-Apr-15 6:49
eso0o11-Apr-15 6:49 
AnswerRe: Creating token for a web service Pin
Richard Andrew x6411-Apr-15 13:51
professionalRichard Andrew x6411-Apr-15 13:51 
GeneralRe: Creating token for a web service Pin
eso0o11-Apr-15 21:24
eso0o11-Apr-15 21:24 
GeneralRe: Creating token for a web service Pin
Sascha Lefèvre13-Apr-15 2:23
professionalSascha Lefèvre13-Apr-15 2:23 
QuestionEntity Data Model Pin
jkirkerx10-Apr-15 13:49
professionaljkirkerx10-Apr-15 13:49 
AnswerRe: Entity Data Model Pin
Dave Kreskowiak10-Apr-15 15:55
mveDave Kreskowiak10-Apr-15 15:55 
GeneralRe: Entity Data Model Pin
jkirkerx12-Apr-15 8:05
professionaljkirkerx12-Apr-15 8:05 
AnswerOk, How about this? Pin
jkirkerx12-Apr-15 13:55
professionaljkirkerx12-Apr-15 13:55 
No Entity Data Model
And just use the Data Access Layer that is compiled as a DLL
So I replaced the GridView with a ListView, wrote code to create the columns, and wrote this code to load the ListView object.

I really don't want to bind to objects. I want to use the benefits of the Data Access Layer concept, but without binding.
All the examples and turtorials I'm able to locate show Entity Framework and binding to objects.
So I got rid of the Entity Data Model and DataSources, and went back to the DAL only.

I'm not clear on the Entity Framework. Wasn't even sure if I was really using it or not, so I deleted the reference to it.
Got a few error messages in teh code I posted below, so I guess I'm using it.
This is a crash course for me on using DAL and Entity Framework, so please bear with me, I am underwater on this subject.
private void load_customers()
{

    lv_customers.Items.Clear();

    // How to use Entity Framework, that's the question
    // I'm using LINQ here to specify the data, and not Entity Framework

    // Basic LINQ Query Operation
    // <a href="https://msdn.microsoft.com/en-us/library/bb397927.aspx">https://msdn.microsoft.com/en-us/library/bb397927.aspx</a>

    using (StoreContext context = new StoreContext())
    {
        var query =
            from customer in context.Customers
            where customer.FirstName == "Randy" || customer.LastName == "Sublett"
            orderby customer.FirstName
            select new
            {
                ID = customer.ID,
                FirstName = customer.FirstName,
                LastName = customer.LastName,
                BusinessName = customer.BusinessName
            };                   

        foreach(var ci in query)
        {
           ListViewItem item = new ListViewItem(ci.ID.ToString(), 0);
           item.SubItems.Add(ci.FirstName);
           item.SubItems.Add(ci.LastName);
           item.SubItems.Add(ci.BusinessName);
           item.SubItems.Add(0.ToString());

           lv_customers.Items.Add(item);

           Application.DoEvents();
        }

   }

}

QuestionChanging a Struct Property Value Pin
Kevin Marois10-Apr-15 11:01
professionalKevin Marois10-Apr-15 11:01 
AnswerRe: Changing a Struct Property Value Pin
harold aptroot10-Apr-15 12:31
harold aptroot10-Apr-15 12:31 
AnswerRe: Changing a Struct Property Value Pin
OriginalGriff10-Apr-15 22:03
mveOriginalGriff10-Apr-15 22:03 
AnswerRe: Changing a Struct Property Value Pin
BillWoodruff10-Apr-15 22:53
professionalBillWoodruff10-Apr-15 22:53 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 1:31
mveRichard Deeming13-Apr-15 1:31 
GeneralRe: Changing a Struct Property Value Pin
BillWoodruff13-Apr-15 1:49
professionalBillWoodruff13-Apr-15 1:49 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 2:02
mveRichard Deeming13-Apr-15 2:02 
GeneralRe: Changing a Struct Property Value Pin
Kevin Marois13-Apr-15 3:06
professionalKevin Marois13-Apr-15 3:06 
GeneralRe: Changing a Struct Property Value Pin
Richard Deeming13-Apr-15 4:12
mveRichard Deeming13-Apr-15 4:12 
QuestionC# Memory Leak Question Pin
Kevin Marois10-Apr-15 10:45
professionalKevin Marois10-Apr-15 10:45 
AnswerRe: C# Memory Leak Question Pin
jschell10-Apr-15 11:36
jschell10-Apr-15 11:36 
GeneralRe: C# Memory Leak Question Pin
Kevin Marois13-Apr-15 3:13
professionalKevin Marois13-Apr-15 3:13 
QuestionEasy Way to Display Multilingual Tooltip and Message Box Pin
Felix Obere10-Apr-15 10:03
Felix Obere10-Apr-15 10:03 
Questionconvert piece of code from C++ to C# Pin
MrKBA10-Apr-15 8:25
MrKBA10-Apr-15 8:25 
AnswerRe: convert piece of code from C++ to C# Pin
RedDk12-Apr-15 16:49
RedDk12-Apr-15 16:49 
Questionsingle quote inside double quote in C# ASP.NET Pin
Rajeshkunwar2510-Apr-15 3:42
Rajeshkunwar2510-Apr-15 3:42 
AnswerRe: single quote inside double quote in C# ASP.NET Pin
OriginalGriff10-Apr-15 3:57
mveOriginalGriff10-Apr-15 3:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.