Click here to Skip to main content
15,748,615 members

Comments by tmbgfan (Top 7 by date)

tmbgfan 1-Feb-12 16:44pm View    
Your code is so contrived that it seems pointless.

Using your example, you can achieve the same result by adding `<asp:AsyncPostBackTrigger ControlID="cmdBind" EventName="Click" />` to the `OtherDataPanel` and then updating the server-side `cmdBind_Click` code to bind both repeaters.

Instead, your example is making two requests to the server instead of one to bind each Repeater separately. Why? Just so you can implement `IPostBackEventHandler` for no good reason? It makes no sense.

You talk about "less bits being transferred", but your technique still delivers the same payload to the client, but in two requests instead of one. You aren't even returning JSON to the client so I am not certain of what these "less bits" are.

Then to top it off you throw insults at someone? Really? Yikes.
tmbgfan 17-Jan-12 16:24pm View    
@Greg - "learn LINQ [...] the correct way". Okay. I guess we should ignore experts like Scott Guthrie [] when they demonstrate the same technique as the OP did because you say it is not the "correct" way.
tmbgfan 17-Jan-12 15:57pm View    
@Greg - To be brutally honest, I probably would not have started this discussion with you except for your vote of 1. Too many times on Code Project I see people voting 1 because "that's not how I do it". Okay, that's great. You do things differently. That doesn't mean that Herin's tip is not viable. His title states it all: "LINQ-to-SQL Mapping Stored Procedure with Multiple Results". Does his tip demonstrate this? Yes. Is it a tip that some might find useful? Yes. Are there other ways to do SIMILAR (not necessarily the same) things? Yes, but that shouldn't garner a vote of 1 as far as I can tell.
tmbgfan 17-Jan-12 15:38pm View    
@Greg - Using your alternative example, yes one can drill down through entity associations using LINQ to get at properties of associated types; I am not arguing that point. However, Herin's example would also apply to calls to stored procedures that return multiple result sets where there is no association between the result sets. It just so happens that in his example data there is an association. So lets just say that your alternative is a viable one when: (1) you are allowed to query the db without using a stored procedure (in some shops this is not an option) and (2) there is an association between the different result sets.
tmbgfan 17-Jan-12 13:56pm View    
@Greg - "this is the correct way to do this".. sure, if the question is "How do you select an aggregate anonymous type using LINQ?". The OP's tip is a perfectly legitimate example of how to split multiple result sets from a stored procedure using LINQ-to-SQL into explicitly defined entity types (not anonymous aggregates).