Search found 23 matches

by nilssonm
Thu 04 Dec 2008 16:06
Forum: LinqConnect (LINQ to SQL support)
Topic: Linq 2 MySQL
Replies: 6
Views: 3919

Example

Here is a small example of how you normally not do. The example simulates a fetch of entities and stored in session in one request and a modification and save in another request in an ASP.NET application.

Code: Select all

            // Fetch and print the employees
            IList employeeList = null;
            using (EmployeesDataContext db = new EmployeesDataContext())
            {
                var employees = from e in db.Employees
                                where e.FirstName == "Nathan" && e.LastName.StartsWith("Pa")
                                select e;
                employeeList = employees.ToList();
                foreach (var employee in employeeList)
                {
                    Console.WriteLine("Employee: {0} {1}, DOB: {2}",
                        employee.FirstName, employee.LastName, employee.BirthDate);
                }
            }
            Console.WriteLine();

            // Modify the list out of a context
            foreach (var employee in employeeList)
            {
                employee.BirthDate = employee.BirthDate.AddYears(10);
                Console.WriteLine("Employee: {0} {1}, DOB: {2}",
                    employee.FirstName, employee.LastName, employee.BirthDate);
            }

            // Re-attach and save the mofifications
            using (EmployeesDataContext db = new EmployeesDataContext())
            {
                db.Employees.AttachAll(employeeList, true);
                db.SubmitChanges();
            }
/Mats
by nilssonm
Wed 03 Dec 2008 14:47
Forum: LinqConnect (LINQ to SQL support)
Topic: Linq 2 MySQL
Replies: 6
Views: 3919

Linq 2 MySQL

Hi,

I am trying to update entities in DB which has lived longer than the context where they where fetched from. For this I am trying to use the Attach method on the Table object with the boolean flag modified set to true. The SubmitChanges method is not generating an update statement to the DB. What am I doing wrong or is this not implemented yet?

Regards,
Mats
by nilssonm
Wed 26 Nov 2008 10:54
Forum: dotConnect for MySQL
Topic: Datatypes in Entity Framework
Replies: 4
Views: 1686

OK, thanks.
by nilssonm
Wed 26 Nov 2008 09:57
Forum: dotConnect for MySQL
Topic: Datatypes in Entity Framework
Replies: 4
Views: 1686

Thank you for the response. I am now wondering if it is possible to manually edit the edmx file to map the unsigned int's to be Int32 instead of the automatically mapped Int64's.

/Mats
by nilssonm
Tue 25 Nov 2008 13:08
Forum: dotConnect for MySQL
Topic: Datatypes in Entity Framework
Replies: 4
Views: 1686

Datatypes in Entity Framework

Hi all,

I am wondering if it is possible to map a booelan (tinyint(1)) in the database to a .NET bool in my objectmodel.
The conversion from database type integer(11) to the .NET type Int64 also confuses me.

/Mats
by nilssonm
Wed 10 Sep 2008 19:12
Forum: dotConnect for MySQL
Topic: EDM .net GUID
Replies: 18
Views: 8775

This sounds great.

Thanks!
by nilssonm
Fri 29 Aug 2008 14:38
Forum: dotConnect for MySQL
Topic: EDM .net GUID
Replies: 18
Views: 8775

Hi Shalex,

I hope you have seen my mailing of the complete project I was testing with.

Mats
by nilssonm
Mon 25 Aug 2008 15:16
Forum: dotConnect for MySQL
Topic: EDM .net GUID
Replies: 18
Views: 8775

Hi All,

It is great that a manual support for GUID's is implemented, but it seems that it is a problem using the GetObjectByKey and TryGetObjectByKey methods with the provider. I am always getting a System.NotSupportedException with "DbType Guid is not supported" in return.

Is there a solution for this problem?

Mats