When creating .dbml/.edmx for a database which has a lot of tables, do you use multiple .dbml /.edmx file or just a single giant file?
Any pro/cons for splitting the model into multiple file?
Thanks,
J.W.
...
In our database, a file is "Processing" if the column "Pending" is set to false on the FileTable and that files FileID doesn't exist in the Transaction table.
How can I construct a LINQ query that basically says,
where f.Pending == False && (f.ID !=exist in db.Transactions.FileID)
The portion in the parenthesis is what I'm not sure ho...
I asked a previous question about mapping an enumerated value on a table using LinqToSql and the answer was to use the O/R Designer to set the type to global::MyNamespace.TMyEnum.
That works OK if your enumeration is based on an integer. But what if your enum is based on a string value? The most obvious application of this is:
public...
This question is related to a previous question of mine
That's my current code
IEnumerable<Shape> Get()
{
while(//get implementation
yield return new Shape(//...
}
void Insert()
{
var actual = Get();
using (var db = new DataClassesDataContext())
{
db.Shapes.InsertAllOnSubmit(actual);
...
Hi,
I am trying to craft a LINQ statement as follows:
The result should follow between two dates (today basically) OR
the result should have a "batchstatus" column that equals false (hasn't been verified yet)
the result should have a "ready" column that equals true (is ready to be verified).
So verifiers can see all data from today ...
My repository returns a list of Accounts.
Each account has a date and a MoneySpent decimal amount. So, I have my list of Accounts and in my controller I'm trying to process this list a little.
I want to have an object which contains the string name of all the months in my Account list and a Sum of all money spent for that month.
Here...
I have two classes, for this example, that are partial classes against LINQ-to-SQL model classes.
public partial class Foo
{
public bool IsValid
{
get { return (GetRuleViolations().Count() == 0); }
}
public IEnumerable<RuleViolation> GetRuleViolations()
{
yield break;
}
partial void OnVal...
I'm using the DataLoadOptions to retrieve the User that modified a Customer's details,
DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Customer>(c => c.ModifiedBy);
However, I only want the User's ID and FirstName and not all the columns. Is there a way to specify the columns you want in the DataLoadOptions?
Tables:
Custo...
Lets say I have a File table with the column, "File_ID".
How can I write a quick LINQ query/statement to set every "File_ID" in the File table to "1"?
I'm using LINQPad in Statement mode, but that doesn't matter really.
...
I have 3 kinds of objects: Agency, BusinessUnit and Client (each with their own respective table)
In terms of hierarchy, Agencies own BusinessUnits, and BusinessUnits own Clients.
I have 3 C# POCO Objects to represent them (I usually select new {} into them, rather than use the LINQ generated classes):
public class Agency
{
public...
I have a lot of existing code which uses raw ADO.NET (DbConnection, DbDataReader, etc). I would like to transition to using LINQ to SQL for new code, but for now put both the existing and new code behind a unified set of Repository classes.
One issue I have is this: I would like the Repository classes to expose result sets as IQueryab...
I am wondering how the shift from relational, table-based design to object-oriented, entity-based design is affecting the mindset of developers writing the next wave of applications.
Given the nature of the debate swirling around the Entity Framework and Linq to SQL, is it premature to be thinking about entity-driven design?
Are we bri...
I'm having a strange issue with my project. It was a Web Site that is now converted to a Web Application that is in a solution. Initially classes were setup using Linq to Sql .dbml file, which stored its connection string in /MyProject/web.config. Now the project ('Web Application') is in a solution and when I modify the Linq to Sql d...
I have asked this question before. but i was not able to get any answer. may be i wasnt very clear. let me give some more details.
I have a SP which returns a long string. here is dbml file code
[Function(Name="dbo.spX")]
public ISingleResult<spXResult> spX([Parameter(DbType="VarChar(8000)")] string str)
{
IExecuteResult result = t...
I have within my Sql Server 2008 database a trigger which will run on insert and update to populate a calendar table with dates calculated from the date info in the first table. (i.e. start date, end date, repeating sequence information).
I am using ASP.Net MVC using Linq to Sql to access the Database. My first view is collecting the da...
There is a proliferation of new LINQ providers. It is really quite astonishing and an elegant combination of lambda expressions, anonymous types and generics with some syntax sugar on top to make it easy reading. Everything is LINQed now from SQL to web services like Amazon to streaming sensor data to parallel processing. It seems like s...
I have a text box, combo box, button and DataGridView on a form that is used to search and return customer information from a MSSQL view (vCustomer). It works great, but I know my code can be more efficient. The four items in the combobox represent columns to search.
Is there a simple way of converting the following to dynamic LINQ to...
I'm trying to use:
// this is a BreakHistory class from the ADO.NET Data Entity Model _entities
_entities.AddToBreakHistory(this);
_entities.SaveChanges();
and I'm getting "An entity object cannot be referenced by multiple instances of IEntityChangeTracker." error
I'm thinking that my update code:
_entities.ApplyPropertyChanges(this...
When I'm adding items from the database into my dbml from the server explorer it complains that the connection strings aren't the same and it won't add my object until they are the same. Once I say OK update my connection string it trashes the formatting of my web.config and I need to remember to switch it back to the correct connection ...
Is there an easy way to take a DataTable and cast it to its entity type?
I have an Entity called Samples, however through layering this is at one point returned as a DataTable - i woud like to be able to cast this to its entity type if possible?
Thanks
...