Skip to content

LINQ

LINQ (all flavours)

This category can be followed from the open social web via the handle linq-e04cf296@forum.codeproject.com

783 Topics 2.8k Posts
  • Stored procedure versus LINQ

    database csharp asp-net linq performance
    5
    0 Votes
    5 Posts
    0 Views
    K
    We've a AS400 system where I work. Finding the correct "flavour" of the AS400/DB2 dlls to support the entity framework from IBM was unecessarily complicated for us. Eventually we had to get ALL versions sent to us and one poor soul in our department had to pick through the documentation to find which version we needed. It took him a week. Full time. That said, now we have it, it seems to work fine. Have a look at the website, try and find the correct flavour for your rig & you'll see what I mean
  • 0 Votes
    1 Posts
    0 Views
    No one has replied
  • Visual Studio 2008

    csharp visual-studio question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Custom Made EDM

    csharp linq business help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • linq equivalent of Sql stmt? [modified]

    csharp database linq help question
    4
    0 Votes
    4 Posts
    0 Views
    E
    Glad to help. Eslam Afifi
  • Filtering Sublist

    csharp linq question
    6
    0 Votes
    6 Posts
    0 Views
    E
    You can iterate over the result returned from the query and modify the original collection. I've just had a crazy idea to do it all in the query and I don't know if it will work or not but here it is anyway. var res1 = from a in aList let bListOriginalCount = a.BList.Count let removedCount = a.BList.RemoveAll(b => !filterList.Contains(b)) where removedCount == bListOriginalCount select a; // will affect ALL items in aList // or var res1 = from a in aList let removedCount = a.BList.RemoveAll(b => !filterList.Contains(b)) where a.BList.Count != 0 select a; // will affect ALL items in aList // or var res1 = from a in aList let matchedInA = a.BList.Intersect(filterList) where matchedInA.Count() != 0 let dummyA = ((Func<A>)(() => { a.BList.RemoveAll(b => !matchedInA.Contains(b)); return a; })).Invoke() select dummyA; // will affect only matched items in aList And you can do it with normal loops. LINQ is puzzler at the begining but with time you will find it easy. It's just some extension methods (static methods over IEnumerable...), lambda expressions (anonymous methods) and relational algebra (kinda) :cool: Please let me know which works and which doesn't. Eslam Afifi
  • Context menu

    tutorial help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • ASP.NET Executing Stored Procedure Using LINQ

    csharp database asp-net linq xml
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    2 Posts
    0 Views
    N
    Check this site. A person with very similar kind of problem of yours found this solution. http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/bce2aced-2284-498a-b206-a9203cd19937[^] Hope this helps :) Niladri Biswas
  • MS Chart - Problem to display the records in Range Column Chart

    help
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Multiple dbml file in One Website

    database csharp linq
    3
    0 Votes
    3 Posts
    0 Views
    E
    I think it's possible to use 2 contexts if you are going to perform the the parts of the query that involve both the contexts on the client side. You do parts of the query that involve a context on its server then you do the parts that involve both on the client. This is done by getting entities involved in the joint query in the client's memory and then do query them locally. The ToArray, ToList, AsEnumerable... can be used to force loading entities to memory from the server. But you must be careful of what you load otherwise you'd end up loading so much data in client memory affecting performance and maybe get a nice OutOfMemoryException :) I've just tried AsEnumerable and it works. Eslam Afifi modified on Monday, June 22, 2009 9:19 PM
  • Fastest bulk lookup

    question database sql-server sysadmin regex
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    3 Posts
    0 Views
    A
    Thanks Eslam, I was also serching same thing. Life Is Beautifull
  • Nolock in vb.net

    csharp database linq
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Date Formats with Linq

    database tutorial csharp linq
    2
    0 Votes
    2 Posts
    0 Views
    N
    You seem to be confused as what Linq is and how to use it. Linq doesn't provide any formatting methods, you do. only two letters away from being an asset
  • Linq with linq query [modified]

    linq csharp javascript database debugging
    5
    0 Votes
    5 Posts
    0 Views
    K
    I don't think you can convert the string to LINQ anyway, but I could be wrong. Assuming you can, someone accessing your web-service could potentially add malicious LINQ code (like the SQL dependancy injection I mentioned in my last post) which would breach the security of your system. In effect you'd be giving anyone with a enough technical knowledge the ability to execute code they'd written on your server, which is very dangerous. If the LINQ query is going to change between pages this suggests that either you should have multiple validation methods on your service per page/ set of field names. If this would lead to too many methods you could pass up a page identifier and select a "where" predicate, one possible solution might look like: // Syntax1 bool DefaultPredicate(YourClassType value) { return value.CompCd == 2; //Or whatever. } bool predicatePage1(YourClassType value) { return value.CompCd == 2; //Or whatever. } //Syntax2 Func<YourClassType, bool> predicatePage2 = (x) => x.CompID == 2 && x.CompCd == 1 ; private Func<YourClassType, bool> GetPredicate(int pageNumber) { if(pageNumber == 1) return predicatePage1; if (pageNumber == 2) return predicatePage2; return DefaultPredicate; } //Page number could be string page code etc. there is probably a way to get this without //needing to pass it up form the HTTP Context if you want to avoid having to remember to //send this up each time. public bool CheckDesc(string departmemtName, int pageNumber) { ... Func<YourClassType, bool> predicate = GetPredicate(pageNumber); var val = DC.DEPTS.Where(predicate).Select(x => x.DeptNM); ... } Having said that, I suspect there will be a better solution than the above as the need to make such verification on a per-page basis implies that there is an underlying design flaw that could be refactored out. Hope this helps!!!
  • LINQ to Entities exception [modified]

    csharp wcf linq sales question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Send data from code behind

    csharp database linq tutorial
    6
    0 Votes
    6 Posts
    0 Views
    M
    Thanks a lot
  • 0 Votes
    4 Posts
    0 Views
    N
    if you need to adjust the database schema each time a new element is added to the xml, then you are in a no win situation. Better to design the database, with extensibility in mind, then transform the xml to match. Xml is nothing more than a collection of name value pairs, i.e. element name and the value, or attribute name and the value, with relationships. only two letters away from being an asset
  • Use same objects to access DB and WebService

    database com
    2
    0 Votes
    2 Posts
    0 Views
    L
    :thumbsdown: