I have ~10,000 records would like to keep in a collection in memory and execute LINQ queries against it. This collection should be available for all the users in the application domain and can access concurrently. I’m looking for a .NET collection that supports multithreading can query asynchronously and efficiently without any threadin...
Hi,
Can any body translate the following c# code to vb. I have tried telarik code converter but I got problem at expression.call and it won't compile at all.
private static IOrderedQueryable<T> OrderingHelper<T>(IQueryable<T> source, string propertyName, bool descending, bool anotherLevel)
{
ParameterExpression param = Expressio...
For some reason my DataContext is not showing all the normal methods like SubmitChanges() etc in the intellisense.
It also won't compile if I type in db.SubmitChanges();
Any idea what I'm doing wrong? Normally I don't have this issue, I have several other projects that work fine...
Image of what I'm talking about:
...
Hi,
I have a situation where I am using NHibernate in a WCF service and using a TransactionScope for the transaction management. NHibernate enlists in the ambient transaction fine, but, any changes I make and save inside the transaction, are not visible to any queries I make while still in that transaction.
So if I add an entity and ses...
Currently i'd like to find all groups within the Active Directory where the current user has the right WriteProperty.
The problem is that i can find all groups where the user directly is inserted, but when the user is within a group and that group has write access it won't show up. I thought that setting the booleans of GetAccessRules()...
Hi all,
I have the following code:
protected void Page_Load(object sender, EventArgs e)
{
XElement xml = XElement.Load(Server.MapPath("ArenasMembers.xml"));
var query = from p in xml.Descendants("members")
select new
{
Name = p.Element("name").Value,
Email...
Hi guys,
Following on from my previous question, I am getting another compilation error on my Linq query:
Compiler Error Message: CS1002: ; expected
Source Error:
Line 42: XElement xml = XElement.Load(Server.MapPath("/members/listmembersxmlfeed?gid" + gid));
Line 43:
Line 44: var query = from p in xml.Descendants("member")
Line 4...
This is probably a very simple question that I am working through in an MVC project. Here's an example of what I am talking about.
I have an rdml file linked to a database with a table called Users that has 500,000 rows. But I only want to find the Users who were entered on 5/7/2010. So let's say I do this in my UserRepository:
from ...
I have two tables that I'm trying to create a relationship between so I can write nice LINQ queries that don't require join.
Widgets
WidgetId
WidgetDescription
Orders
OrderId
WidgetId
OrderDate
What I want to be able to do is create a LINQ query that does something similar to:
var result = from x in db.Widgets
Where x.Orders.Order...
Hello
I have 2 string arrays, and I would like to return if any of them exists in _authRole array. How is that done?
string[] _userRoles = userdata.Split(',');
string[] _authRoles = AuthRoles.Split(',');
bool isAuthorized = _authRoles.Any(_userRoles ??);
/M
...
I have a logins table which records all login and logout activities. I want to look at all login activities of a particular user within 24 hrs. how to do it? something like this:
var records = from record in db.Logins
where record.Users.UserId == userId
&& record.Timest...
In other languages (ruby, python, ...) I can use zip(list1, list2) which works like this:
If list1 is {1,2,3,4} and list2 is {a,b,c}
then zip(list1, list2) would return: {(1,a), (2,b), (3,c), (d,null)}
Is such a method available in .NET's Linq extensions?
...
static void Main()
{
string[] a = { "a", "asd", "bdfsd", "we" };
a = a.OrderBy(fun).ToArray();
}
private static int fun(string s)
{
return s.Length;
}
its is giving compile time error . I know that we can do this with Lambda expression like this. a.OrderBy(s=>s.Length).ToArray(); but i ...
Obviously, it's easier to do with some developers, but I'm sure many of us are on teams that prefer the status quo.
You know the type. You see some benefit in a piece of new technology and they prefer the tried and true methods.
Try, for example, DBA/C# programmer the advantages of using LinQ ( not necessarily LinQ to SQL, just LinQ in...
I have two dictionaries with the same structure:
Dictionary<string, int> foo = new Dictionary<string, int>()
{
{"Table", 5 },
{"Chair", 3 },
{"Couch", 1 }
};
Dictionary<string, int> bar = new Dictionary<string, int>()
{
{"Table", 4 },
{"Chair", 7 },
{"Couch", 8 }
};
I'd like to sum the values of the dictiona...
I have a Logins table which records when user is login, logout or loginFailed and its timestamp. Now I want to get the list of loginFailed after last login and the loginFailed happened within 24 hrs.
What I am doing now is get the last login timestamp first. then use second query to get the final list. do you think I should join those t...
I got a list of objects in the following query. How to delete items in the middle, saying I want to delete item in 2, 5, and 7 position? thanks
var archivedPwds = from archivedPwd in db.PasswordArchive
where archivedPwd.UserId == userId
orderby archivedPwd.DateCha...
public class Class1 : List<Class2>
{
}
public class Class2 : List<Class3>
{
}
public class Class3
{
string str;
int i;
}
public class Program
{
Class1 c = new Class1();
//insert values....
List<Class3> all = ??;
}
How can i get a one-dimensional collection in my var "all" ?
please note I can not modify Class1, c...
Currently Table Storage supports From, Where, Take, and First.
Are there plans to support any of the other 29 operators?
Are there architectural or design practices in regards to storage that one should follow in order to implement things like COUNT, SUM, GROUP BY, etc?
If we have to code for these ourselves, how much of a performance...
Hi all,
How do I use Linq to extract a single XML attribute form each XML file in a directory and put that element in a C# list. Do I have to loop thru each file one-by-one? The XML files are quite large so I'd like to do this without loading the entire file into memory.
Thanks,
j
...