예제 #1
0
        private void AddMapType(DemoContext _ctx)
        {
            var mapTypeMange = new mapTypes();
            var mapTypes     = mapTypeMange.GetMapTypes();

            foreach (var type in mapTypes)
            {
                var mapType = _ctx.MapTypes.SingleOrDefault(x => x.Id == type.Id);
                if (mapType == null)
                {
                    var newType = new MapType
                    {
                        Id    = type.Id,
                        Name  = type.Name,
                        Value = type.Value
                    };
                    _ctx.MapTypes.Add(newType);
                    _ctx.SaveChanges();
                }
            }
        }
예제 #2
0
 public DemoContextSeed(ILogger <DemoContextSeed> logger, DemoContext context)
 {
     _logger = logger;
     _ctx    = context;
 }