Hello everyone,
I've recently been reading Louis Davidson's book on Sql Server Database Design and found it quite informative. I've picked up on alot of concepts that I didn't previously know alot (or anything) about. Primarily - I picked up on a way to set up database relationships that I hand't tried before.
Basically you use a surro...
The following query works. I get the correct result back when I enter the name with a wrong casing.
private static IObjectContainer db = Db4oFactory.OpenFile(db4oPath);
public static IQueryable<Company> GetCompaniesByName(string name) {
return (from Company c in db
where c.Name.ToLowerInvariant().Equals(nam...
Hi
i received a request to create a Music Player with specific features ,sincerely i did not develop a Music Player in past time(just 7 months i began to develop programs Smile ).
I try to explain correctly these features requested right now.
This Music Player will Play music in modality "Random" (first request) downloading songs from a ...
I have a large collection of strings (up to 1M) alphabetically sorted. I have experimented with LINQ queries against this collection using HashSet, SortedDictionary, and Dictionary. I am static caching the collection, it's up to 50MB in size, and I'm always calling the LINQ query against the cached collection. My problem is as follows...
I'm using .NET 3.5 and would like to be able to obtain every nth item from a List. I'm not bothered as to whether it's achieved using a lambda expression or LINQ.
Edit
Looks like this question provoked quite a lot of debate (which is a good thing, right?). The main thing I've learnt is that when you think you know every way to do som...
Hey All,
I've been using several different tuts in order to build a LINQ-to-LDAP model. I've just about got it complete, but I'm running into some issues trying to bind the data returned to a class.
I do the reverse part by assigning custom attributes to the properties of the class that are the actual names of the database fields.
...
edit: in case anyone is wondering, the actionhandler invokes code that creates and disposes the same kind of datacontext, in case that might have anything to do with this behaviour. the code doesn't touch the MatchUpdateQueue table, but i figure i should mention it just in case.
double edit: everyone who answered was correct! i gave the...
I have an IEnumerable<T> and an IEnumerable<U> that I want merged into an IEnumerable<KeyValuePair<T, U>>, where the indexes of the elements joined together in the KeyValuePair are the same. Note I'm not using IList, so I don't have a count or an index for the items I'm merging. How best can I accomplish this? I would prefer a LINQ answe...
I have a nice little Linq2SQL project however when deployed the database is on another server. I keep getting a named pipe error that the remote server doesn't exist - yet it does, it has Named Pipes enabled (protocol + surface) SQL 2005. TCP connections work fine.
I've tried setting the library in the connection string to a TCP one, I ...
Does anyonw know how to extend, i.e., add funcionalities to the Entity Designer in Visual Studio?
For instance, I want to right click a property of an entity on the designer and have a new option on the context-menu that allows me to do any stuff I want.
...
I'm having trouble getting a LINQ compound select to compile. Here is the code:
int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
int[] numbersB = { 1, 3, 5, 7, 8 };
var pairs =
from a in numbersA,
b in numbersB
where a < b
select new {a, b};
The code is from a tutorial from here, under the heading 'SelectMany - Compo...
Hi All,
I am trying to sort a List like this:
public void Example()
{
string target = "hello";
List<string> myStings = new List<string>();
myStings.Add("babab");
myStings.Add("Helll");
myStings.Add("atest");
myStings.OrderBy(each => Distance(each, target));
}
public int Distance(string stringA, string string...
Anybody know of a way to batch NHibernate queries using NHibernate.Linq like you can do with MultiCriteria and ICriteria objects?
With MultiCriteria I can create something like this:
var crit = session.CreateMultiCriteria()
.Add(session.CreateCriteria(typeof(Entity1)).Add(Restrictions.Eq("Property1","Value"))
...
since i am using POCOS in my domain, i want my repository to be able to received Expression filters of the type of my POCOS and change the parameter in the expression to be the of type of my LINQ tables, my fields have the same name as my members so i was able to accomplish this for 1 and 2 lambda conditions by breaking into members and ...
I want to update the value of a column in a resultset returned by a linq query.
My code is something like this
var result=from r in db.contents
select new { match = r.text, id = r.id, index1 = (long)-1}
-- some calculation to find index value --
-- now update r.index=calculatedIndexValue for each record in result
Is this kind of ...
Hi!
I'm using Linq 2 Sql and I'd like to add a custom member on one of my data type. For example: I have tables Companies, Departments and Employees. Departments has a FK in Companies and Employess has a FK in Deparments. Very simple.
My goal is to add an EmployeeCount property on Company that will, of course, returns the number of emp...
What would be the best approach to allow users to define a WHERE-like constraints on objects which are defined like this:
Collection<object[]> data
Collection<string> columnNames
where object[] is a single row.
I was thinking about dynamically creating a strong-typed wrapper and just using Dynamic LINQ but maybe there is a simpler so...
I am trying to get into LINQ to objects as I can see the power of it. Lucky enough I have a question that I think LINQ should be able to solve.
Here is the question (the details are an example);
public class SchoolClass
{
public int ID;
public string Name;
public string Teacher;
public string RoomName;
public strin...
Is it possible to create an 'Entity' that will be an abstraction of a relationship between tables that live in two different tables, in two different databases, on two different machines, and even possibly using two different dbms?
For example, if I have a SQL Server db on one machine that stores all my customers, and I have an Oracle d...
I've been reading up on LINQ lately to start implementing it, and there's a particular thing as to how it generates UPDATE queries that bothers me.
Creating the entities code automatically using SQLMetal or the Object Relational Designer, apparently all fields for all tables will get attribute UpdateCheck.Always, which means that for ev...