I'm looking for either a web-based or Windows-based way to point to a relational data source using automated schema exploration (or, even better, a reflection-based approach that would work on any IQueryable in-memory data source) and allow easy exploration of data, traversing between records in related tables, etc. Basically a dynamic ...
I am trying to formulate a LINQ query to select a sublist of a list where it meets a where condition like so:
List<Entities.Base> bases = this.GetAllBases();
List<Entities.Base> thebases = from aBase in bases
where aBase.OfficeCD == officeCD
select aBase;
where Base is just...
Pseudo code:
SELECT * FROM 'table' WHERE ('date' < today) OR ('visible' = false)
How do you do OR in Linq?
...
I have a variable IEnumerable<IEnumerable<int>>. I'm trying to somehow aggregate it into an IEnumerable<int> which enumerates over all the integers in order. (All the integers from the first set, then all the integers from the second, etc.) I looked into LINQ's aggregate method, but the only examples I found was string concatenation, and...
Saw several similar questions here, but none of them seemed to quite be my issue...
I understand (or thought I understood) the concept of closure, and understand what would cause Resharper to complain about access to a modified closure, but in the below code I don't understand how I'm breaching closure.
Because primaryApps is declar...
need help to accomplish this in linq.
I have 3 tables.
Customers
CustumerOrder
OrderDetails
I need to list in one query all customers ( only if they have placed atleast one order) with all the orders for each customer only if order value is greated than 100.
Regards,
Harsh
...
Okay, to build on my previous question:
http://stackoverflow.com/questions/3999761/generically-checking-for-null-that-wont-box-nullables-on-a-non-constrained-type
One user suggested putting a constraint for class and for struct and I also implemented the UnboxT pattern of specializing for the three types and storing that logic in delega...
Here is how I would write a function to make an acronym in Java style:
string makeAcronym(string str)
{
string result = "";
for (int i = 0; i < str.Length; i++)
{
if (i == 0 && str[i].ToString() != " ")
{
result += str[i];
continue;
}
...
I have data of the following form:
{
"sections" : [
{
"section" : {
"Term" : "News",
"Term ID" : "4,253"
}
},
{
"section" : {
"Term" : "Sports",
"Term ID" : "4,254"
}
},
// ...
]
}
I would like to serialize it into a collection of the following class:
publ...
I have the feeling that using joins could make this cleaner
public override string[] GetRolesForUser(string username)
{
using (TemplateEntities ctx = new TemplateEntities())
{
using (TransactionScope tran = new TransactionScope())
{
int userId = (from u in ctx.Users
where u.UserName == u...
We have an object and we want to build a linq query based on that object on the fly. This linq statement is equivalent to what we want to build:
Expression<Func<Sample, bool>> linqExpression
= x => x.Child == itemToCompare.Child;
We can't quite come up with the right expression to build the itemToCompare.Child part. Here'...
I'm having a Dictionary like
Dictionary<String, List<String>> MyDict = new Dictionary<string, List<string>>
{
{"One",new List<String>{"A","B","C"}},{"Two",new List<String>{"A","C","D"}}
};
I need to get a List<String> from this dictionary, The List should contain Distinct items from the values of the above ...
i want to sort a list in c#
like where structure property AVC goes to true then show them first then AVC goes to false. are any way to do this in c# linq
...
Hello SO;
I'm having a problem understanding how to do something in LINQ.
I have a linkedlist, the type of the object doesn't matter. What does matter is that I want to do something in a Where() based on the relationship between the current object and the next one in the list.
Why can't I do something like:
linkedlist.Where(n=>a_fun...
Wierd question title...
What i am trying to accomplish is pretty simple i think.
I got 3 tables in the database,
BlogPost - BlogPostTagsConnection - Tags
The blogpost contains text, title, slug, author, id etc. The BlogPostTagsConnection contains the BlogPost id and the Tags id and finally the Tags contains tagid and tag.
So i tried...
The list view is like
i need to add the data from the Listview to a Dictionary<String,String>.
Now i'm using for loop to do this. Is there any way to do this using LINQ.
Finally the Dictionary will contain
{"A","1"}
{"B","2"}
{"C","3"}
EDIT My code :
Dictionary<String, String> Dic = new Dictionary<string, string>();
...
The First Dictionary is like
Dictionary<String, String> ParentDict = new Dictionary<String, String>();
ParentDict.Add("A_1", "1");
ParentDict.Add("A_2", "2");
ParentDict.Add("B_1", "3");
ParentDict.Add("B_2", "4");
ParentDict.Add("C_1", "5");
i need to convert this into a new Dictionary...
I am trying to select existing images from a directory. The image files are being renamed dynamically when they are created but the format they currently have cannot be changed. This is an example.
client_2010_10_23_001.jpg
Essentially, the images are names according to upload time and incremented. Perhaps split the file name into ...
I am creating a store with ASP.NET 4.0 MVC and C# and am fairly new to it.
I have come to creating the View page that displays the products within a certain category.
On the specific category page I want to have the product list and also want the category name with its relevant description taken from the database.
Currently the way I ...
Is .Skip().Take() the only way to get paging in Entity Framework? Is there some way to select the row number in the output so I could use Where( p => p.row > 9 && p.row <21)?
select top 100 ROW_NUMBER() over (order by ID) as row, *
from myTable
I would think the ROW_Number() field must exist in the generated SQL for it to know what ...