Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Pass LINQ object form Biz Class
Message
De
06/07/2010 14:29:00
 
 
À
06/07/2010 14:13:24
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Divers
Thread ID:
01471528
Message ID:
01471560
Vues:
33
I guess this is really an EF question then - I think something similar came up on another thread here recently.
There may be a more eloquent way but, TBH, I'd go for a relatively 'quick-n-dirty' solution:
In the EDMX designer copy and paste the current Directories object, rename it, knock out the fields you do not want surfaced in the getDirectory() method and then use that version instead.

Can't say I'm thrilled with this suggestion - but it works :-}

>Your example works but I am concerned that this won't accomplish what I would like to do. I am trying to build n tier data classes that I can us. I am working on a small web project now so I will use that as an example. I have my entity model setup against MS Sql server. I would like to setup a business class layer that holds the LINQ queries to access my data. In my web pages I would simply like to call the business layer to get the data object to populate the web page. Your example will do that. The next step I would like to post back the web page and save any changes. It looks to me like your example would break the ability to save the changes back. That means that I would have to send an object of the data from the page to the business class, then get the data from the EM model, update the EM object and the save. This seems like a kludge at best.
>
>All the examples that I can find show the LINQ code in the code behind of the web page. So is this even possible?
>
>a "Scatter,Gather Name " command would be really nice about now :).
>
>>The results in the debug window are the same. You can view them in the Debugger but, as before, you will not be able to access them in code - except as dynamic types as mentioned in my other post. If you need to access the collection outside the getDirectory() method then use a known class. e.g:
public class Address
>>    {
>>        public string Address1 { get; set; }
>>        //etc
>>    }
then:
public IEnumerable<Address> getDirectory()
>>        {
>>                       var queryobj = from dr in this.oEFobject.DIRECTORies
>>                       select new Address
>>                        {
>>                            Address1 = dr.ADDRESS1
>>                            //etc
>>                         };
>>          return queryobj;
>>        }
>>
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform