I'm working with an application which allows customers to create and import custom tables. I have the need to allow those customers to build dynamic queries against the imported custom tables and I would like to be able to use LINQ to do this.
I'm familiar with how to create Dynamic LINQ queries however all the methods I know of require...
Is there a way to replace all existing values from XML with values from dictionary using Linq? I'm using c#.
XML example:
<root>
<node1> <--without attribute
<subNode1>someTextValue</subNode1>
</node1>
<node2 name="myNode2"> <--With attribute (IMPORTANT!!!)
<subNod1>someOtherTextValue</subNode1>
</node2>
</root>
Dicti...
Hello,
I prepare a WPF project, where I want to implement a more complex search. I use LINQ to entities through the ADO.NET Entity model and plan to do the display in WPFToolkit DataGrid.
My search window should allow search by a few different criteria. My idea is to be able to write in (for example) name, surname and occupation textbo...
Hi all,
I have a table was named "MYTABLE". That have two columns "FIRSTNAME" and "LASTNAME".
Two query below returned same result is IQueryable<MYTABLE>
dataContext.MYTABLEs.Where(f => f.FIRSTNAME == firstName && f.LASTNAME == lastName);
from t in dataContext.MYTABLEs
where t.FIRSTNAME == firstName && t.LASTNAME == lastName select t;...
i want to make a webproject with Subsonic and Dynamic Data...
But when i go register the ContextData a don't have it in subsonic with LINQ...
in Global.asax.cs a have to do something like this
model.RegisterContext(SubSonicRepo, new ContextConfiguration() { ScaffoldAllTables = true });
how can i make it work?
have some way to make ...
ok guys, bare with me. I'll summarize first, then go into detail.
I've written a number of methods (.WhereOr, .WhereAnd) which basically allow me to "stack up" a bunch of lambda queries, and then apply them to a collection. For example, the usage with datasets would be a little like this (although it works with any class by using generi...
Is NHibernate.Linq 1.0 GA Provider Production Ready ?
...
Say I've got a list of strings with Swedish words: banan, äpple, apelsin, druva
Now I want to get this list ordered (keep in mind that this is a very simplified version of the real query):
var result = from f in fruits // The list mentioned above
orderby f
select f
This will give me: apelsin, äpple, banan, d...
I have a linq to sql query
var items = from p in ctx.bam_Zending_AllInstances
join q in ctx.bam_Zending_CompletedRelationships
on p.ActivityID equals q.ActivityID
join r in ctx.bam_Prestatie_AllInstances
on q.ReferenceData equals r.ActivityID
where q.ReferenceType == "Activity" &&
p.Zendingnummer =...
I'm getting a ChangeConflictException in my web application when the code updates a certain row within a certain table. The best I can tell it seems as though two users are completing the transaction at the same exact time and optimistic concurrency only affect the SubmitChanges() method instead of doing the lock when the row is selected...
I use Ria Service domainservice for data query.
In My database, there is a table People with firstname, lastname. Then I use EF/RIA services for data processing.
Then I create a Filter ViewModel to capture user inputs, based it the input, I construct a linq Query to access data.
At server side, the default DomainService query for pe...
So I didn't see a question here that really answers this question. It's kinda a newbie question about linq but I would like to know if it would be possible to convert the following sql query (built using C#) into a linq query:
public void DoSomeQuery(bool whereCriteria1, bool whereCriteria2)
{
string sqlQuery = "SELECT p.*";
str...
public List<SavedOption> GetValidSavedOptions(
List<Option> itemOptions,
List<SavedOption> savedOptions)
{
List<SavedOption> finalSavedOptions = savedOptions.Where(x =>
OptionTextDoesMatch(y, x) &&
itemOptions.Any(y => y.SomeID == x.SomeID)
).ToList();
}
I am totally new to LINQ and Lambdas.
In th...
Hi I have a list that looks like this:
val1 val2
r1 10 3
r2 5 5
r3 9 7
r4 4 1
r5 2 9
r6 1000 0
I need to get the row in which both values are at their maximum together for example:
val1 val2
r1 10 3 no match both values can be highe
r2 5...
This may be a simple fix (well, it probably is) but for some reason I just can't figure it out.
So, I have some xml that looks something like this:
XElement xml = XElement.Parse (
@"<Alphabet>
<a name="A" />
<b name="B" />
<d name="D" />
<e name="E" />
</Alphabet>");
So later in my code, I reference a node that ma...
The following code is in Haskell. How would I write similar function in C#?
squareArea xs = [pi * r^2 | r <- xs]
Just to clarify... above code is a function, that takes as input a list containing radius of circles. The expression calculates area of each of the circle in the input list.
I know that in C#, I can achieve same result, by...
Hello everyone,
I want to know how to replace a simple foreach loop with linq. I'm not looking for answers about 2 or more loops....It's specifically for a single foreach loop..
List<string> strlist=new List<string>();
strlist.Add("Hello");
strlist.Add("World");
//The main "to be linq" here...
foreach(string str in strlist)
{
Cons...
Hi;
Very primitive question but I am stuck (I guess being newbie). I have a function which is supposed to send me the list of companies : ALSO, I want the caller to be able to specify a top element for the drop-down list as well.. (say for "None"). I have following piece of code, how I will append the Top Element with the returning Sele...
I have seen two different approaches for creating generic repositories. What are differences between those two approaches (pros and cons) ?
Please diregard difference in the methods because I am interested in difference between
public interface IRepository<T> where T : class
and
public interface IRepository : IDisposable
Is th...
I've got some collections of data objects that can't directly be accessed from one another. I imagine the best solution would be to get the database guys to make a query for this, but in the meantime, is there some way to tighten this up?
var conflicting = allFoos.Where(foo => foo.ElectronicSerialNumber != 0
...