I have a need to query an existing Sybase ASE database and would like to use Linq syntax for my data retrival.
I don't need write access, nor do I need the full set of Linq operators, just Select(),
SelectMany(), Where(), and GroupJoin()
What are options are available?
In particular, I'm wondering about nHibernate and building a ne...
Hi,
I am trying to modify some open source code to change how it filters search results. I want to query by the 'name' of a record instead of it's key. (I have records with duplicate names I want to pull back, but different keys.)
This pulls back all the records
public static IEnumerable<ticket> GetTickets(stDataContext db, bool? ...
I have this basic entity setup:
public class Instrument
{
public virtual int Id { get; set; }
public virtual Guid? InstrumentGuid { get; set; }
public virtual string FIPSCode { get; set; }
public virtual IList Names {get; set;}
}
public class Name
{
public virtual int Id {get; set;}
public virtual string Name {g...
Today is my first day using ASP.NET MVC, and I'm finding it very intriguing. I only just started learning asp.net.
So basically I'm trying to call a procedure from an MSSQL database, and with it I need to send a paramater "PlaceID", which is an integer. This procedure basically just picks out a number of columns from different tables in...
Caveat emptor, I'm new to Linq To SQL.
I am knocking up a prototype to convert an existing application to use Linq To SQL for its model (it's an MVVM app). Since the app exists, I can not change its data model.
The database includes information on events; these are either advertising events or prize events. As such, the data model inc...
I'm just learning LINQ and in particular LINQ to XML, and I've written up a query that works but I'm wondering if I'm doing it a bit round-a-bout. Can the code be improved?
I have an XDocument:
<SomeDocument>
<Prop1> val1 </Prop1>
<Prop2> val2 </Prop2>
<Prop3> val3 </Prop3>
</SomeDocument>
But Prop1, Prop2, and Prop3 ma...
We have two tables - Tasks and TasksUsers (users assigned to task). Task has EntityCollection called TaskUsers.
This query returns number of tasks per username:
model.TaskCountByAssignee =
(
from t in TaskRepository.List()
from tu in t.TaskUsers
group tu by tu into tug
sel...
Just started to get my feet wet with C# and .NET, liking it so far. I think I've got the main gist of the C# language constructs, so what technology should I dive into next: F# or LINQ?
I'm aiming for both "broadening my horizont" programming-wise AND for "Enhancing my resume" in no particular order.
UPDATE: From reading your replies ...
I have 2 lists. The first is a CountryId-list that can look like this
036
208
999
The seccond list is a coundryId to Name list that can look like this:
036, AUSTRALIA
208, DENMARK
380, ITALY
578, NORWAY
The result shall be like this:
AUSTRALIA
DENMARK
UNKNOWN ID (999)
How can I make a linq query that solves this?
...
I'm building SQL expressions from LINQ Expressions and liking it verry much. However an issue with refactoring has come up. Suppose I want to check the Method of a MethodCallExpression, I would do something like this:
MethodCallExpression expr = ... // An expression from somewhere...
if (expr.Method == typeof(SqlFilterExtensions).Get...
I'm a rookies of EF so, sorry for my perhaps foolish question.
I've 2 entities without any relationship (VS does not load the join and I can't manually add it because the primary key of the child uses a derivated key of its parent).
Example
Entity master
Products
keys GKey_K, Product_K
fields .....
Entity detail
GenericInformation
...
Given the output of query:
var queryResult = from o in objects
where ...
select new
{
FileName = o.File,
Size = o.Size
}
What would you consider the neatest way to detect if a file is in the queryResult?
H...
I have the following code that fills dataTable1 and dataTable2 with two simple SQL queries, dataTableSqlJoined is filled from the same tables but joined together.
I'm trying to write a LINQ query that can create the dataTableLinqJoined as if it had been created using SQL. In my example below, it only returns the values from dataTable1.
...
There is a table in a databse, let's call this table Document.
This table has fields:
MajorVersionNumber
MinorVersionNumber
ReleaseDate
There are rules to determine the order of versions and their expiration dates. I'll give the rule of finding expiration date of a version in C# 3 because it looks more easy to read then in English.
...
How would you implement paging in a LINQ query?
Actually for the time being, I would be satisfied if the sql TOP function could be imitated. However, I am sure that the need for full paging support comes up sooner later anyway.
var queryResult = from o in objects
where ...
select new
...
Hi
I have a table with many anniversaries : Date + Name.
I want to display the next anniversary and the one after with Linq.
How can i build the query ?
I use EF
Thanks
John
...
If I have an IEnumerable where ClassA exposes an ID property of type long.
Is it possible to use a Linq query to get all instances of ClassA with ID belonging to a second IEnumerable?
In other words, can this be done?
IEnumerable<ClassA> = original.Intersect(idsToFind....)?
where original is an IEnumerable and idsToFind is IEnumerabl...
i have this MySQL statement from a search page, the user enters there postcode and it finds the nearest stiocklist within 15 MIles of the entered postcode.
SELECT * , (
(
ACOS( SIN( "+SENTLNG +" * PI( ) /180 ) * SIN( s_lat * PI( ) /180 ) + COS( " + SENTLNG +" * PI( ) /180 ) * COS( s_lat * PI( ) /180 ) * COS( (
" + SENTLANG + " - s_ln...
Hi
I have an object Customer with a 1-n relationship to Addresses.
I want to be able to take the first address. So i create a method:
public Address firstAddress
{
get
{
var f=from d in this.Addresses
select d;
return f;
}
}
I get the following error :
Error 5 Impossible to find an i...
Hai I have An XDocument .All nodes in this document have an attribute UserId. I want to change the value of this attribute 0 to 1. How to do this using Linq query. I used this.
MyNewUserPermission.Descendants("menuNode").Single.SetAttributeValue("userId", Me.UserId)
It's not Working.Error shows
Sequence contains more than one element...