My fitnesse tests fail with linq datacontext. I already tried adding a suite.config and then app config to my c:\fitnesse folder - where the .jar file is.
I added -c option c:\Fitnesse\suite.config to the command section on the test page. Here's the suite.config file: c:\fitnesse\myapp.config ^.svn$
Here's the myapp.config file:
The ...
I would like to know if it is possible to map a 1-many database relationship as an array of primitives on the parent object class. For example, say I have a database as follows:
TABLE: PERSON
ID - int
TABLE: PERSON_EMAIL_ADDRESSES
PERSON_ID - int
EMAIL_ADDRESS - string
For my Person class, I'd like to have the following:...
I have a fairly complex query where I am filtering results with a LIKE statement. Here is the query:
var qsFilter = entities.QueryStatements.Where("it.Statement LIKE @searchTerm",
new ObjectParameter("searchTerm", searchTerm));
var qtFilter = entities.QueryTables.Where("it.TableNames LIKE @searchTables",
new ObjectParameter("s...
I need to sort in memory lists of strings or numbers in ascending or descending order. However, the list can contain null values and all null values must appear after the numbers or strings.
That is the input data might be:
1, 100, null, 5, 32.3
The ascending result would be
1, 5, 32.3, 100, null
The descending list would be
100, ...
Hi
I have an ef model and i want to "query" it using objectquery. So far i create my objectquery like this:
myQuery = new ObjectQuery<T>(mergeOption, context)
Is it possible to create an objectquery without the specifying the context right from the start (set it later on)? In my application i have multiple threads that needs to get t...
I have a list of strings in C#, and want to create a list of unique characters that are in the strings in the list, using LINQ.
I have so far worked out how to turn the List into a List, but I can't work out how to get the LINQ to go further than that.
What I have so far is as follows:
List<string> dictionary = new List<string>(someAr...
i created my Form programaticall using System.Reflaction. i want to add database with SubmitChanges. i will get data from whole txtbox and using any loop to fill Entity property. And than Submitchanges.
public static void Save( PlaceHolder Holder)
{
if (Holder.Controls.Count > 0)
{
fo...
I have a Linq to SQL DBML
Contained within the DBML is a stored proc
When the proc is executed via Microsoft SQL Server Managment tool it return 60 rows.
Bu the DBML doesnt think that it returns any results.
Has anyone had this issue before or know how to resolve it?
Sp
EDIT Code:
[Function(Name="dbo.WQNT_PeekViewNextZone")]
publ...
i can this with ado.net but i want to use it linqtosql
foreach (string ky in ld.Keys)
{
cmd.Parameters.AddWithValue(ky, ld[ky]);
}
public bool AccessProcess(string sp, ListDictionary ld, CommandType cmdType)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["conn"].ToString());
SqlCommand cmd = new SqlC...
Hi is there anyway to write somthing like this
var r = from i in myList
group i by i.Number
into grp
select new
{
Reported = grp.Select(x => x.CurrentStatus).First(),
Number = grp.Key,
...
I'm still trying to get the hang of LINQ and am having trouble with this. I have a List<Data> like so:
GroupId|SectionId|Content
-------------------------
1| 3|part1-2
1| 7|part1-1
3| 3|part3-2
1| 1|part1-3
3| 1|part3-3
3| 7|part3-1
I would like to convert ...
The gist of the problem is that we have an alumni table (one record per person) and also a couple of other tables (one to many) that have degree info and interest info. In a search screen in our app you can search for criteria that spans all three tables (there are actually more fields and tables than shown in the example below but I am...
How can I use LINQ to to XOR bytes together in an array? I'm taking the output of an MD5 hash and would like to XOR every four bytes together so that I can get a 32 bit int out of it. I could easily do this with a loop, but I thought it was an interesting problem for LINQ.
public static byte[] CompressBytes(byte[] data, int length)
{
...
I have a couple of DBML generated classes which are linked together by an id, e.g.
ClassA {
AID,
XID,
Name
}
ClassB {
AID,
ExtraInfo,
ExtraInfo2
}
In using something like db.ClassAs.Where(XID == x) and iterating through that result,
it ends up executing a query for each of the ClassAs and each of ClassBs, which is slow.
Alternat...
I am looking at creating an application to record gym workout(set,reps, etc) and I was wondering what framework and database backend to use. I am currently thinking C# .Net 3.5 for the framework because I am familiar with it but I'm unsure about how to store the data. Originally I was thinking of xml files and parsing through them but th...
Hi
I have code like:
var entityX = this._xService.GetAll();
var entityY = this._yService.GetAll();
Both are returned as IEnumerable types. I need to inner join the two into a something like a JoinedList class that has to be IQueryable.
I'm looking for ways to do this please using LINQ.
Many Thanks
...
i have function
public List<string > UserList()
{
var q = from i in _dataContext.PageStat group i by new { i.UserName } into ii select new { ii.Key.UserName };
}
how can i return List ?
...
I saw this excellent post:
http://sqldud.blogspot.com/2009/01/how-to-convert-csv-to-xml-using-c.html
I have a csv file with the column titles in the first row of the csv.
I would also like the linq statement to be able to handle a variable length number of columns.
That way I would not have to change the code if more columns are added.
...
I have many-to-many relation between persons and addresses
Person { Id, ... }
Address { Id, ... }
Address2Person { Id, PersonId, AddressId }
DBML-generated classes looks like (there are PK and FK on diagram):
class Person {
Id, Address2Person
}
class Address2Person {
Id, Person, PersonId, Address, AddressId
}
class Address {
...
I am trying to get a random object within linq. Here is how I did.
//get all the answers
var Answers = q.Skip(1).Take(int.MaxValue);
//get the random number by the number of answers
int intRandomAnswer = r.Next(1, Answers.Count());
int count = 0;
//locate the ans...