Here's the method i want to write:
public static IEnumerable<String> GetTableNames(this IQueryable<T> query)
{
//...
}
where the IQueryable is a linq-to-sql query (is there a more specific interface i should use?).
then if i had a query like this
var q = from c in db.Customers
from p in db.Products
from cp in db...
I was learning this ORM because think this is good technology for most projects. But most employers required acquirement of ADO.NET and SQL.
This ORM not will use in high-loaded system (like popular web-sites)? In which types of projects this ORM will be useful? Are highly loaded projects using ORM?
...
i have a language table which is as a foreign key in the link table , The link can be in 3 languages meaning there will be 3 rows in the link table every time i enter the record . i am using jQuery tabs to enter the records in 3 languages . OK so that thing is that there will be three text boxes for every field in the table.link name fie...
how to extract DataTable or DataSet from Linq Query or List.
e.g I have linq query like this
MyDBpDataContext dcSp = new MyDBpDataContext();
dcSp.myProgrammSP().ToList();
I wrote an Sp which sends a Table as result and I have code which is already using DataTable So I want to convert this result in DataTable.
...
Hi, looking for a way to create Linq-to-SQL Master-Detail WinForms DataGridViews where the Detail part of the Linq query is a custom one.
Can do fine this:
DataClasses1DataContext db = new DataClasses1DataContext(".\\SQLExpress");
var myQuery = from o in db.Orders select o;
dataGridView1.DataSource = new BindingSource()
{
DataSource...
I'm trying to take advantage of Bidirectional serialization of some relational Linq-2-Sql generated entity classes. When using Unidirectional option everything works just fine, bu the moment I add IsReferenceType=true, objects fail to get transported over the tcp binding.
Sample code:
Entity class:
[Table(Name="dbo.Blocks")]
[DataCo...
If it's important to keep data access 'away' from business and presentation layers, what alternatives or approaches can I take so that my LINQ to SQL entities can stay in the data access layer?
So far I seem to be simply duplicating the classes produced by sqlmetal, and passing those object around instead simply to keep the two layers a...
I want to display list of items which belong to certain category like this:
Category I
Item 1
Item 2
Item 3
Category II
Item 6
Item 7
Category III
Item 10
Item 11
Item 12
Item 13
What is the best (and easiest) way to do this? I started doing this with two queries - one gets all goals, and then in foreach loop (in controller)...
How to differentiate between two select new fields e.g. Description
c.Description and lt.Description
DataTable lDt = new DataTable();
try
{
lDt.Columns.Add(new DataColumn("AreaTypeID", typeof(Int32)));
lDt.Columns.Add(new DataColumn("CategoryRef", typeof(Int32)));
lDt.Columns.Add(new DataColumn("De...
In my model I have these entities:
public interface IOrder
{
string Name {get;set;}
List<IProduct> OrderedProducts {get;set;}
}
public interface IProduct {}
In partial class generated by linq-to-sql I map these properties on my entity properties:
public partial class Order : IOrder
{
List<IProduct> OrderedProducts
{
...
Hi Everyone,
I have a shared object through net remoting. The problem is that this object has some EntitySet and EntityRef attributes. When I try to run the program I get an exception telling me that EntitySet is not marked as Serializable. If I mark it as Serializable everything seems to be ok, but when I try to access from outsied to...
I know this could be opinion, but I'm looking for best practices.
As I understand, IQueryable implements IEnumerable, so in my DAL, I currently have method signatures like the following:
IEnumerable<Product> GetProducts();
IEnumerable<Product> GetProductsByCategory(int cateogoryId);
Product GetProduct(int productId);
Should I be usin...
is it posible to implement a gridview with linq 2 SQL entities that allow commit all the updated rows together after a button click or maybe a way to rollback the changes if the user clicks a cancel button?
thanks!
...
I'm building an ASP.NET MVC site that uses LINQ to SQL.
In my search method that has some required and some optional parameters, I want to build a LINQ query while testing for the existence of those optional parameters.
Here's what I'm currently thinking:
using(var db = new DBDataContext())
{
IQueryable<Listing> ...
Hello,
I've create a SPROC that saves an object and returns the id of the new object saved. Now, I'd like to return an int not an int?
public int Save(Contact contact)
{
int? id;
context.Save_And_SendBackID(contact.FirstName, contact.LastName, ref id);
//How do I return an int instead of an int?
}
Thanks for helping
...
Back in late 2008 there was a lot of debate about the future of LINQ to SQL. Many suggested that Microsoft's investments in the Entity Framework in .NET 4.0 were a sign that LINQ to SQL had no future. I figured I'd wait before making my own decision since folks were not in agreement.
Fast-forward 18 months and I've got vendors providi...
We have a project using LINQ to SQL, for which I need to rewrite a couple of search pages to allow the client to select whether they wish to perform an and or an or search.
I though about redoing the LINQ queries using PredicateBuilder and have got this working pretty well I think. I effectively have a class containing my predicates, e....
I'm looking for a good guide into the right method of using Linq to Sql together with WPF.
Most guides only go into the bare basics like how to show data from a database but noone I found goes into how to save back to the database. Can you answer or point out to me a guide that can answer these questions.
I have a separate Data project...
I am using SQL Server 2008, developer edition. I connect to my database from my asp.net mvc application using Linq2SQL. I noticed that my database went into recovery mode about 4 times in a span of a month. I am running a few complext Linq2SQL queries. When database is in recovery mode, my asp.net mvc application is going off line as it ...
The below code will fill User Records in "users".
Dim users= From p In oDbUser.USERs Where p.STATE= "MI" And p.STATUS = 1
Can anyone tell me how can i use a foreaach loop in the result and take each indidual row items ?
...