Beispiel #1
0
        public static SimGroup GetSimGroup(
            int simGroupId,
            string contextName = DefaultContextName
            )
        {
            SimGroup simGroup = null;

            using (var db = new ArcheanContext(contextName))
            {
                simGroup = db.SimGroups.Where(sg => sg.SimGroupId == simGroupId)
                           .FirstOrDefault();
            }
            return(simGroup);
        }
Beispiel #2
0
        public static void RemoveSimGroup(
            int simGroupId,
            string contextName = DefaultContextName
            )
        {
            SimGroup simGroup = new SimGroup()
            {
                SimGroupId = simGroupId
            };

            using (var db = new ArcheanContext(contextName))
            {
                db.SimGroups.Attach(simGroup);
                db.SimGroups.Remove(simGroup);
                db.SaveChanges();
            }
        }
Beispiel #3
0
        public static void NoCnxn()
        {
            try
            {
                using (ArcheanContext context = new ArcheanContext())
                {
                    // Interception/SQL logging
                    context.Database.Log = (string message) => { Debug.WriteLine(message); };
                    context.Sims.Add(new Sim {
                        SimType = "Honda", Description = "Fit", SimParams = "2009"
                    });

                    context.SaveChanges();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public static SimGroup SaveSimGroup(
            string simGroupType,
            string description,
            string simgroupParams,
            string contextName = DefaultContextName
            )
        {
            SimGroup simGroup = null;

            using (var db = new ArcheanContext(contextName))
            {
                simGroup = new SimGroup
                {
                    SimGroupType   = simGroupType,
                    Description    = description,
                    SimGroupParams = simgroupParams
                };
                db.SimGroups.Add(simGroup);
                db.SaveChanges();
            }
            return(simGroup);
        }