I am using LINQ to SQL with C#.
Is there a method through which we can generate entity class files from the table schema?
By dragging tables onto the graphical designer classes are generated but they are not the real class files(i mean actual files with the extension cs).
I am aware of that we can code the class files first and then cr...
I would like to know if it is possible to map a 1-many database relationship as an array of primitives on the parent object class. For example, say I have a database as follows:
TABLE: PERSON
ID - int
TABLE: PERSON_EMAIL_ADDRESSES
PERSON_ID - int
EMAIL_ADDRESS - string
For my Person class, I'd like to have the following:...
Hello :)
Using MVC 2 I have been trying to make this record store project.
Creating records work but updating them doesn't. No exceptions are thrown either.
I examined getchangeset() right before submitchanges() it shows all zeros.
Thanks for your reading and you help :)
The Edit view:
<% using (Html.BeginForm("Edit", "Song")) { %>
...
I have the following lamda expression:
IEnumerable<Order> query
= _ordersRepository.GetAllByFilter(
o =>
o.OrderStatus.OrderByDescending(os => os.Status.Date).First()
.Status.StatusType.DisplayName != "Completed"
||
o.OrderStatus.OrderByDescending...
i created my Form programaticall using System.Reflaction. i want to add database with SubmitChanges. i will get data from whole txtbox and using any loop to fill Entity property. And than Submitchanges.
public static void Save( PlaceHolder Holder)
{
if (Holder.Controls.Count > 0)
{
fo...
i can this with ado.net but i want to use it linqtosql
foreach (string ky in ld.Keys)
{
cmd.Parameters.AddWithValue(ky, ld[ky]);
}
public bool AccessProcess(string sp, ListDictionary ld, CommandType cmdType)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["conn"].ToString());
SqlCommand cmd = new SqlC...
I have a small L2S database that was generated with the L2S CreateDatabase command. When I add a class or property to the DBML, the database is not updated automatically. I get errors like "Table not found" at runtime.
Is there a way to add new tables and columns to a database?
...
I originally built my site in MVC 1.0 using the NerdDinner tutorial as a basic outline. Many of the early design decisions were made simply b/c "that's how NerdDinner did it" Since then, it has really grown and was converted to 2.0.
My validation still works the way NerdDinner did it and is very minimal, so although I've read about ot...
OK, so i've got a DataGridView for some Project Management Software, i want to be able to double click a row it opens a form and fills in the fields and combo boxes with the relvant data, so that i can change what ever needs to be changed. In this case the most important thing is changing the Status. As in the Project Management Software...
I am using VB .Net for this, so I don't have access to var or this would be a simple matter.
Right now my query is as follows
Dim errors As IOrderedQueryable(Of IGrouping(Of String, RSError)) = (From e In db.RSErrors
Where e.UserID = "msarchet"
...
I have many-to-many relation between persons and addresses
Person { Id, ... }
Address { Id, ... }
Address2Person { Id, PersonId, AddressId }
DBML-generated classes looks like (there are PK and FK on diagram):
class Person {
Id, Address2Person
}
class Address2Person {
Id, Person, PersonId, Address, AddressId
}
class Address {
...
I am using linq to sql as ORM for my asp.net mvc website.
I dont know how will linq to sql behave in the following situation.
Suppose one of the action from a active session, modifies a row of a table
and before saving the changes to the database, I mean before calling _db.SubmitChanges() another action from some other session tries to...
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'm creating a repository and service layer in my app, and my repo has a very simple function
Public Function GetRegions() As IQueryable(Of Region) Implements IRegionRepository.GetRegions
Dim region = (From r In dc.Regions
Select r)
Return region.AsQueryable
End Function
Now in my Service layer...
Hi.. my linq knowledge is ok. i need only a loop or any other method to accomplish ado.net method :(LOOK PLEASE BOLD CODES)
public bool AccessProcess(string sp, ListDictionary ld, CommandType cmdType)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["conn"].ToString());
SqlCommand cmd = new SqlCommand(s...
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...
What's wrong with my code? For the Employee table and the table Project are underlined in red ...
Thanks in advance!
DataContext db = new projfuncionarioDataContext();
var query = from p in db.Funcionario
join c in db.Projeto on p.Cdfunc equals c.Cdfunc
select new
{...
I have a table in SQL Server 2008 with uniqueidentifier field.
In my application (C#, WPF) I have a textbox which intended for search some data by GUID, user can enter guid by typing, ctrl+v, etc, so he/she can make an error.
What is the best and fastest approach to make a search by this field using linq2sql ignoring whitespaces, "-".....
.Net MVC application also running Linq-to-SQL.
I have seen many articles on grids that will operate in this environment but none that will capture data - all simply display and sort/order.
I need to dynamically add project codes as columns and have days of the week as rows. The individual cells will contain hours worked - yup this is ...
Hi,
Current ASP.Net MVC 2 uses Linq to SQL or Linq to entites? i am using VS 2008.
Cheers
...