I'm working on a record-level security system for a LINQ-to-SQL app. I currently have a wrapper around the DataContext's GetTable method that joins T to a user cross-reference table. T is any class that implements my ISecurable interface:
public interface ISecurable
{
bool CanRead { get; set; }
bool CanUpdate { get; set; }
...
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've got an IQueryable repository (admittedly this is the first time I've tried this) and I can't seem to get it to pull the correct data using Skip(1).Take(1)
Here's the repository
Public Function GetActivity() As IQueryable(Of ActivityLog) Implements IActivityLogRepository.GetActivity
Dim activity = (From a In dc.Activity...
I have a function called GetUserByOpenId I don't want to be using this function at all
Public Function GetUserByOpenID(ByVal claimedidentifier As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Join o In dc.OpenIDs On u.ID Equals o.UserID
Where...
Is it possible to access the DataContext object behind an IQueryable?
If so, how?
...
I have:
a stored procedure which retrieves zip codes in a radius around another zip code
a table with contacts
I'm getting the contacts through an IQueryable interface which I've extended with various extension methods to filter results by age etc.
What I have trouble with is adding an IQueryable extension method which calls the st...
Hi,
In my ASP.NET MVC 2 C# web app
I have a repository that contains method that returns an Iqueryable. My controller calls this, handing over some variables to it so it an run a linq to sql query.
How can I check to see if the returning iqueryable has returned anything/contains anything to the controller? Basiclly check if it is returns...
I have an array of strings and an IQueryable (called MyTypeQbl).
I want to iterate through the strings in the array which do not have a corresponding MyType.MyString.
I thought this would be:
foreach (string str in stringsArr.Where(s => MyTypeQbl.Count(m => m.MyString == s) == 0))
But is this just more complex than it should be? Is...
I'd like to expose a Repository as an 'IQueryable' type.
The repository uses Linq to NHibernate to communicate with the database.
Can anyone point me at an example implementation?
For example, what would the corresponding 'GetEnumerator()' implementation on my repository look like?
Edit:
Would something like this be appropriate?
pu...
Given the following classes:
class Order
{
public int Id;
public string OrderNumber;
public DateTime OrderDate;
}
class OrderItem
{
public int Id;
public int OrderId;
public string ProductName;
public decimal Price;
}
class OrderComment
{
public int Id;
public int OrderId;
public string Subject;...
I have a the following domain classes:
public class Pony
{
public string Name { get; set; }
public DateTime FoundDate { get; set; }
}
public class Person
{
public ICollection<Pony> Ponies { get; private set; }
public Pony NewestPony
{
get
{
return Ponies
.OrderBy(pony => ...
i want to use Linq's Iquerable that gives me the ' query that gets only the records needed to the page'
based on the Page size i have given.
i have used this:
System.Linq.IQueryable<DataTable> ds =
(from m in dttableDetails.TableName select m).Take(page_size).Skip(offset);
but it is showing me error. i need the returned type as ...
Hi,
I have a quite simple WCF service method which returns an IQueryable, just for testing. Perhaps I got something wrong when trying to understand what IQueryable is designed for. I clearly plan to use this with the IQueryable provider of NHibernate later. But first I ran into some sort of serialization problems (at least I think it mi...
Using two tables with a one to many relationship (such as Make -> Model), how do I return a Make with limited Model children in an IQueryable function?
When I pass in “camry” as a variable, I want to get back a Toyota Make with only children called “camry”, not all children. Basically, I want to recreate this SQL statement:
SELECT
...
I am new to Linq, though I was thinking of making use of LINQ expressions to query within the collections of my business objects.
We have created a new hierarchical set of models with several properties. Some properties have a List<classx>. Would I be able to change the type to IQueryable<classx>? But then how would I add a new instanc...
At point (3) in my code I have defined a query called query1 in which I defined a .Where lambda expression. This query is in some way dynamic but still contains static elements, it always refers to the Type Employee and its (int) property ClientID.
Now I very much like to make the refering to the type and its property dynamic, based on...
Hello,
I'm pretty new still at C# so I might be doing something stupid, but I've spent some time looking at this and still can't see what the problem is.
Here are some code snippets:
double work = 0;
ProjectRepository pr = new ProjectRepository();
IQueryable<CalendarDetail> cds;
// Find matching day of...
I've been using Union on IQueryable<> (with the same type) to try to get one collection produced from two collections, but it is not working. I believe my understanding is at fault with regards to the IQueryable members.
I thought I could use the union method to build (within a foreach) a SQL statement which would execute something like...
This is my code:
IQueryable<Car> list = new List<Car>().AsQueryable<Car>();
foreach (TreeNode node in DataHierarchyTree.CheckedNodes)
{
var a = from c in ContextDB.Cars
where c.CarID == Int32.Parse(node.Value)
select c;
list.Union(a.ToList());
}
CarGridView.DataSourc...
Basically i want to merge two Iqueryable to one Iqueryable and then return the complete record set after my loop ends. It runs perfectly but in the end my objret have nothing but when i debug the loop obj have some records. wht im doing wrong
IQueryable<MediaType> objret = Enumerable.Empty<MediaType>().AsQueryable();
var typ = _db.Media...