Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Type     t             = typeof(Program);
            Assembly assemFromType = t.Assembly;

            Console.WriteLine("Assembly that contains Example:");
            Console.WriteLine("   {0}\n", assemFromType.FullName);

            // Get the currently executing assembly.
            //Assembly currentAssem = Assembly.LoadFrom(@"C:\Users\Bartosz\Dysk Google\Studia\Technologie Programowania Adaptacyjnego\TPA_repo\UnitTest\ExampleDLL.dll");
            Assembly         currentAssem = Assembly.LoadFrom(@"..\..\..\UnitTest\TPA.ApplicationArchitecture.dll");
            AssemblyMetadata assemblyMeta = new AssemblyMetadata(currentAssem);

            using (MainContext db = new MainContext("D:\tpa.mdf"))
            {
                Model.DTO.AssemblyDataBaseDTO blog = assemblyMeta.ToBaseDTO().MapToDatabaseModel(); //ZLE
                db.assemblies.Add(blog);
                db.SaveChanges();

                // Display all Blogs from the database
                var query = from b in db.assemblies
                            orderby b.Name
                            select b;

                Console.WriteLine("All blogs in the database:");
                foreach (var item in query)
                {
                    Console.WriteLine(item.Name);
                }

                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
        }
 public void SaveToRepository(AssemblyMetadata assemblyMetadata, string file)
 {
     repository.GetImport().SaveToRepository(assemblyMetadata.ToBaseDTO(), file);
 }