Search Results

Search found 3 results on 1 pages for 'mehanik'.

Page 1/1 | 1 

  • Parallel EntityFramework

    - by mehanik
    Is it possible to make some work in parallel with entity framework for following example? using (var dbContext = new DB()) { var res = (from c in dbContext.Customers orderby c.Name select new { c.Id, c.Name, c.Role } ).ToDictionary(c => c.Id, c => new Dictionary<string, object> { { "Name",c.Name }, { "Role", c.Role } }); } For exampe what will be changed if I add AsParrallel? using (var dbContext = new DB()) { var res = (from c in dbContext.Customers orderby c.Name select new { c.Id, c.Name, c.Role } ).AsParallel().ToDictionary(c => c.Id, c => new Dictionary<string, object> { { "Name",c.Name }, { "Role", c.Role } }); }

    Read the article

  • C# 4.0 dynamics

    - by mehanik
    Hi. Code bellow is working well until I have class ClassSameAssembly in same assembly as class Program. But when I move class ClassSameAssembly to separate assembly I have runtime error. Is it posible to resolve it? using System; namespace ConsoleApplication2 { public static class ClassSameAssembly { public static dynamic GetValues() { return new { Name = "Michael", Age = 20 }; } } internal class Program { private static void Main(string[] args) { var d = ClassSameAssembly.GetValues(); Console.WriteLine("{0} is {1} years old", d.Name, d.Age); } } }

    Read the article

  • Entity framework 4 add to many-to-many

    - by mehanik
    I have model whith 3 tabels and one is link table with additional field: Groups Id Name Users Id Name Roles Id Name LinkTable Id GroupId UserId RoleId The quuestion is how to add 3 related entities: Code bellow doesn't work. using (var db = new dbEntities()) { db.Groups.AddObject(Group.CreateGroup(1, "TestGroup")); db.Users.AddObject(User.CreateUser(1, "AdminUser")); db.Roles.AddObject(Role.CreateRole(1, "Admin")); db.UserGroupRoles.AddObject(UserGroupRole.CreateUserGroupRole(1, 1, 1, 1)); db.SaveChanges(); }

    Read the article

1