I've one interface which has following method signatures:
public interface ITag
{
int M_Id { get; set; }
string M_Name { get; set; }
}
And I have a class that implements the interface above:
[Table(Name="News")]
public class NewsTag:ITag
{
[Column(Name="id",isPrimaryKey = true)]
public int M_Id
{
get; set;...
If I have Table3 that has a FK pointing to Table2 which has a FK pointing to Table1 what I'm seeing via intellisense is I can reference Table2 from Table3 but I can't go Table3.Table2.Table1 it only goes one layer deep.
from t3 in Table3
where t3.t2.property == "some value" && t3.t2.t1.property == "some other value"
select t3.t2.t1;
T...
I am working on a web application using ASP.NET 3.5. The application has hundreds of tables. I was told in a seminar that I should use one .DBML file for the entire application instead of using multiple .DBML files (there was also a post in stackoverflow that said the same thing). Given that I have so many tables does using one .DBML f...
I am having a problem with a treeview in my WinForm app. I created a TreeViewItem class that holds the data. There are only 5 fields: CaseNoteID, ContactDate, ParentNoteID, InsertUser, ContactDetails.
public class TreeItem
{
public Guid CaseNoteID;
public Guid? ParentNoteID;
public string ContactDate;
public string Ins...
Here's my problem: I have an IPerson which is implemented by Employee and Student. What I really want is what you see below. One LINQ statement to get each type of IPerson. This works great until I call the method ;). It makes sense as to why I'd get the error, but I am really struggling as to find a decent way to pull all IPerson o...
Hey,
I'm having some trouble with a linq query. It's a simple problem, but I'm not sure what the best way to approach it would be. I have two tables (I'm only showing relevant fields) called Artist and Song:
ARTIST - int ArtistID (pk)
varchar Name
SONG - int SongID (pk)
uniqueidentifier UserID (To lookup songs the use...
If I had two tables such as this:
Profile Table
-------------
PK ProfileID int
FK AddressPrimaryID int
FK AddressSecondaryID int
Address Table
-------------
PK AddressID int
Address nvarchar
City nvarchar
State nvarchar
Zip nvarchar
Notice, the profile has a two relationships to the same table, the address table. When I create my li...
I am trying to write a Linq to SQL statement which displays all customer records and only the matching max(InvoiceId) of the invoice table; basically the newest invoice for the customer. The left join is required because a customer may not have any invoices but need to be in result set.
Two basic tables with a foreign key of Customer.C...
I have suddenly faced a problem with moving some records in a SQL Server database from one table to another, using LINQ to SQL. Is it possible to write in LINQ to SQL a query just as simple as this:
INSERT INTO Table2 SELECT * FROM Table1 WHERE Selected = 1
GO
DELETE FROM Table1 WHERE Selected = 1
GO
without using loops and collectio...
Is it possible "in anyway" that I can use Linq to SQl on a Mono project?
If it's actually .net port then if I import the System.data.Linq and the DBML that generated in VS, will it work?
THanks!
...
Hi!
I'm have a list of keywords;
pizza (10:13 PM)
milk (10:12 PM)
pizza (10:11 PM)
pizza (10:10 PM)
milk (10:09 PM)
beans (10:08 PM)
corn (10:07 PM)
juice (10:06 PM)
foo (10:05 PM)
I want to group them like this (top 5, notice foo is not in the list):
Pizza (3) (10:13 PM)
Milk (2) (10:12 PM)
Beans (1) (10:08 PM)
Corn (1) (10:07 PM...
I have a simple query:
var results = from k in db.tree_nodes
join s in db.stocks
on k.tree_nodes_id equals s.tree_nodes_id
into tmpTable
from rowtmp in tmpTable.DefaultIfEmpty()
select new
{
stock = (rowtmp.amount == null) ?
...
Hi, I'm learning LINQ, and am having trouble with inserting and updating in one go. I have a StatusReport table (School, Customer, Time), where School is the primary key, and a Service table (School, ServiceName, State, and Version), where School is a foreign key, and School + ServiceName is the primary key.
Here's my update code:
pub...
Hi.
I saw DamienG's article (http://damieng.com/blog/2009/06/24/client-side-properties-and-any-remote-linq-provider) in how to map client properties to sql.
i ran throgh this article, and i saw great potential in it. Definitely mapping client properties to SQL is an awesome idea.
But i wanted to use this for something a bit more compli...
This error is being generated when I try to change a foreign key.
I know this is a very common error I’ve found tons of information about it and tried to implement the fixes I’ve found but I still get this error when trying to update Keys. Reference Thread
Originally I was just directly assigning the value and not trying to map the ent...
I am working on a content management system which is being sort of retrofitted onto an existing database, and the database has many many tables. There will be a staging database, where we will make changes and allow users to 'preview in place'. Then any changes have to be approved, and to publish them we will connect to a live version ...
Just began to develop using LINQ, and still can't understand some simple things.
So,
LinqTable.SingleOrDefault(t=>(t.Field1=="value1")) is equal to SQL "SELECT * FROM LinqTable WHERE Field1="value1" LIMIT 1"
How to create (using Linq) the query like "SELECT * FROM LinqTable WHERE Field1="value1" AND Field2="value2" LIMIT 1?
...
I'm creating a custom MembershipProvider for an ASP.NET MVC website, and I was planning on using LINQ to SQL for the internals, as I am for the rest of the website. Are there any issues with this, specifically any security issues it causes?
...
With the query below I am doing multiple joins and selecting them all. I want to return this result into a list, so in this case I would have a List with a count of three, assuming that there are three addresses associated with this single customer id order...Right now the query works but I put exp.ToList() it gives me essentially a 2d l...
Out of my lack of SQL Server experience and taking into account that this task is a usual one for Line of Business applications, I'd like to ask, maybe there is a standard, common way of doing the following database operation:
Assume we have two tables, connected with each other by one-to-many relationship, for example SalesOderHeader a...