SQL to LINQ generator
Hi; I am new to LINQ and just wanna know; is there any application in which I type standard SQL and it gives me its representing statement in linq? ...
Hi; I am new to LINQ and just wanna know; is there any application in which I type standard SQL and it gives me its representing statement in linq? ...
I have xml files with following to generate the menu for our web site. <xs:element name="Menu"> <xs:complexType> <xs:sequence> <xs:element name="MenuItem" type="MenuItemType" maxOccurs="unbounded"></xs:element> </xs:sequence> <xs:attribute name="Title" type="xs:string"></xs:attribute> <xs...
I am fairly new to SubSonic 3/Linq, and don't know if I'm missing something obvious, but I think I ran into a projection issue. I am trying to perform the most basic query, and getting back proper results only when I use anonymous types. The moment I swap the anonymous types with regular class types, I get all properties set to null/zero...
Which is the best solution for 3-tier arch. Linq to SQL or Nhibernate? Specifically, I will upgrade a system in 2-tier architecture to 3-tier architecture? Edit: And where can I find good tutorials or videos for both? ...
I am doing a CRUD operation on Database generated class(using LINQ2SQL) in my WPF application. All of my DB tables have IsDelete property exists. So I want to define an abstract/interface class to do the SoftDelete(). My question here is, how can I define my Generic class in such a way as to access T.IsDelete = true ? or in code I want t...
Say I have a class public class TimestampedTrackId { private readonly int trackId; private readonly DateTime insertTime; public TimestampedTrackId(int trackId, DateTime insertTime) { this.trackId = trackId; this.insertTime = insertTime; } public int TrackId { get { ...
I'm starting out with nHibernate and have a simple example that I cannot get working as I'd like. I have two model objects (Blog and Posts) and I would like to load them all in a single query for one scenario. I want lazy loading in other cases. I naively thought that I could write something like this: var blogs = session.Linq<Blog>(...
Here's my problem: a user searches for products by size. The result should show all products of the desired size (if any) plus products progressively larger and smaller until there are at least 50 undersized and 50 oversized products displayed in addition to the correctly-sized products. The result should always show all products of a ...
hi all i have just started learning linq because i like the sound of it. and so far i think im doing okay at it. i was wondering if Linq could be used to find the following information in a file, like a group at a time or something: Control Text Location Color Font Control Size example: Label "this is text that will appear on a lab...
How to perform this without iteration, with LINQ? string[] flatSource = {"region1", "subregion1", "region2", "sub1", "sub2", "region3", "sub1", "sub2"}; string previousRegion = ""; foreach (var item in flatSource) { if (SomeRegionDictionary.Contains(item)) previousRegion...
This is my LINQ statement var Query = from products in pLDataContex.Products where (products.Id == p) select new OrderProductMapping { OrderId = insertedOrderId, ProductId = p, ProductPrice = Convert.ToInt32(products.Price.ToString()), P...
I have a scenario where I define the XSD first, then generate the cs files from these XSD (using xsd.exe). I need to take this 2 steps furthur by generating the dbml from these and then calling CreateDatabase() on that dbml). So the question is, does anyone have an idea how to create dbml from either an XSD or a cs file? Thanks Ash ...
Hi I need to select rows from database table using filtering by xml-type column. table looks like (short version) id dbfield int xmlfield xml and i'm filtering it in this way IQueryable<Data.entity> q = from u in datacontex.entities select u; if (val1.HasValue) q = q.Where( x => x.dbfield > val1.value) if (val2.HasValue) q = ...
I want to select all the fields of one table, and only specifics fields of a second table. Are there any way to do it like with table.* in SQL? var things = from t in db.table1 from t2 in db.table2 where ...Join Clause... select new { t.*,t2.onefield} obviously this code don't work, but I thi...
I have a fair amount of questions and my first one is how can I do a simple LINQ query to match a word in a file? I'm not trying to be stupid but i haven't understood the documentation that I found for LINQ properly. ...
I've been asked to apply conditional sorting to a data set and I'm trying to figure out how to achieve this via LINQ. In this particular domain, purchase orders can be marked as primary or secondary. The exact mechanism used to determine primary/secondary status is rather complex and not germane to the problem at hand. Consider the d...
In our database we have a table with more then 100000 entries but most of the time we only need a part of it. We do this with a very simple query. items.AddRange(from i in this where i.ResultID == resultID && i.AgentID == parentAgentID orderby i.ChangeDate descending select i); After this Query we get a List with up to 500...
I have a linq query in which I need to specifically do a left join. However when I attempt to commit a lambda Skip function on the query it errors and says that the skip cannot be performed on a linq query with a join. Here's the query (the skip variable is a parameter into the function and clientDB is the datacontext): Dim...
I've done a brief search of this site, and googled this, but can't seem to find a good example. I'm still trying to get my head around the whole "Lambda Expressions" thing. Can anyone here give me an example ordering by multiple columns using VB.Net and Linq-to-SQL using a lambda expression? Here is my existing code, which returns an o...
I would like to ask a follow up question to an oldie (but goodie) Reading the list of References from csproj files (though I am not the author of that question). In my parsing of the csproj files I need to select all Compile elements that have Link element as a child. I first attempted to extend the answer to the linked question as fol...