コード例 #1
0
        static void Main(string[] args)
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges <CellToolContext>());

            using (var db = new CellToolContext())
            {
                ImageHandler ih = new ImageHandler();

                // C:\Users\thoma\Documents\00GitHub\00_LOCAL_ONLY\
                Console.Write("Enter path for new Cell Group: ");
                var imagePath = Console.ReadLine();
                Console.Write("Enter Cell Type(rbc or wbc): ");
                var cellType = Console.ReadLine();
                Console.Write("Enter Cell group name: ");
                var groupName = Console.ReadLine();

                string[] fileEntries = Directory.GetFiles(imagePath);

                foreach (string line in fileEntries)
                {
                    var cur = new CellGroup
                    {
                        CellType  = cellType,
                        GroupName = groupName,
                        ImagePath = line
                    };

                    // mapping to ef model and adding to virtual table
                    db.OriginalCellData.Add(cur);
                    db.SaveChanges();
                }
            }

            /*
             * In this article I will explain with an example, how to perform select, insert, edit, update,
             * delete using Entity Framework in ASP.Net using C# and VB.Net.
             * This process is also known as CRUD i.e. Create, Read, Update and Delete in
             * GridView using Entity Framework in ASP.Net.
             * //*/
            //SqlCommand cmd;
            //SqlConnection con;
            //SqlDataAdapter da;

            //con = new SqlConnection(@"Data Source =.\SQLEXPRESS; Initial Catalog = CellData; Integrated Security = True; MultipleActiveResultSets = True");



            //ImageHandler ih = new ImageHandler();


            //// Entity framework here
            //Database.SetInitializer(new CellToolInitializer());



            //string sourceDir = "C:/Users/thoma/Documents/00GitHub/00_LOCAL_ONLY/Symmetric_Rbc_Crop/";
            //// add file name; if in, don't add
            //string[] fileEntries = Directory.GetFiles(sourceDir);

            //console.writeline(sourcedir);
            //foreach (string line in fileentries)
            //{
            //    //console.writeline(line);
            //    byte[] arr;
            //    image img = image.fromfile(line);
            //    arr = imagetobytearray(img);

            //    sqlbulkimport(arr);



            //}
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: tjdurant/Images
        static void Main(string[] args)
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<CellToolContext>());

            using (var db = new CellToolContext())
            {

                ImageHandler ih = new ImageHandler();

                // C:\Users\thoma\Documents\00GitHub\00_LOCAL_ONLY\
                Console.Write("Enter path for new Cell Group: ");
                var imagePath = Console.ReadLine();
                Console.Write("Enter Cell Type(rbc or wbc): ");
                var cellType = Console.ReadLine();
                Console.Write("Enter Cell group name: ");
                var groupName = Console.ReadLine();

                string[] fileEntries = Directory.GetFiles(imagePath);

                foreach (string line in fileEntries)
                {
                    var cur = new CellGroup
                    {
                        CellType = cellType,
                        GroupName = groupName,
                        ImagePath = line
                    };

                    // mapping to ef model and adding to virtual table
                    db.OriginalCellData.Add(cur);
                    db.SaveChanges();
                }

            }
            /*
            In this article I will explain with an example, how to perform select, insert, edit, update,
            delete using Entity Framework in ASP.Net using C# and VB.Net.
            This process is also known as CRUD i.e. Create, Read, Update and Delete in
            GridView using Entity Framework in ASP.Net.
            //*/
            //SqlCommand cmd;
            //SqlConnection con;
            //SqlDataAdapter da;

            //con = new SqlConnection(@"Data Source =.\SQLEXPRESS; Initial Catalog = CellData; Integrated Security = True; MultipleActiveResultSets = True");

            //ImageHandler ih = new ImageHandler();

            //// Entity framework here
            //Database.SetInitializer(new CellToolInitializer());

            //string sourceDir = "C:/Users/thoma/Documents/00GitHub/00_LOCAL_ONLY/Symmetric_Rbc_Crop/";
            //// add file name; if in, don't add
            //string[] fileEntries = Directory.GetFiles(sourceDir);

            //console.writeline(sourcedir);
            //foreach (string line in fileentries)
            //{
            //    //console.writeline(line);
            //    byte[] arr;
            //    image img = image.fromfile(line);
            //    arr = imagetobytearray(img);

            //    sqlbulkimport(arr);

            //}
        }
コード例 #3
0
ファイル: LabelController.cs プロジェクト: tjdurant/Images
 public LabelController()
 {
     _db = new CellToolContext();
 }
コード例 #4
0
ファイル: LabelController.cs プロジェクト: tjdurant/Images
 public LabelController()
 {
     _db = new CellToolContext();
 }