"Dotnetcore rapid development framework based on EF Core's code First mode" completes support for the generation of DB first codes

Source: Internet
Author: User

Preface to the previous article, "EF Core-based code first model Dotnetcore Rapid development Framework" has been over the past half a year, time flies, years flies ... The more embarrassing is, in this half of the year, in addition to daily with the baby to cook, occasionally pick up a few private, personal open source project almost nothing movement. So what do you do in your daily work? Must be to stick to Nfx ah ... Why is it? Do not do nfx that is impossible, after all to eat ... True, the big mountain as a new first-line network of Red Big city environment, Dotneter live very strong, see another wave of soaring housing prices and this crisis year, or silently add up after class night run dozens of kilometers, exercise good body, more than a few single late-night part-time, perhaps luck to touch a less than 20 years of struggle for a shortcut ... The premise is to do a variety of watertight safety measures to prevent sudden death and die ... As for many pits or pits, has been silly, anecdotal rumors of the folk God's "Chongqing job-seeking anti-pit handbook" has already been sprayed, even before the opportunity, technology giant Microsoft Baba released Dotnetcore 2.1, with its consistent urine style, should be able to get on the bus. However, I still adhere to Nfx, after all, mature platform mature products and mature human structure, the leap forward is sure to bear all kinds of pinning labels risk. Although the materializing on the car hopeless, private hooking up or a chance. A few days ago, we received a warm and sincere demand from friends, added support for DB First, lazy people have lazy blessing ... What's new Gayhub address: Https://github.com/VictorTzeng/Zxw.Framework.NetCore Specific update content, large and small or a bit more, here is not wordy serious words, specific circumstances specific code see.
    1. Add Efcore direct return to DataTable function
    2. Dbfirst features, currently only supports SQL Server, MySQL, npgsql three kinds of databases. Generate the entity code directly from the existing data table, as described in CodeGenerator
    3. Add a unit test project and complete the test for the two new features above
    4. Introduction of IOC container Aspectcore.injector, see AspectCoreContainer.cs
Hands, touch you.

Currently only supports SQL Server, MySQL, Npgsql and other three kinds of databases, the following:

  1. Inject dbcontextoption
  2.  1  services. configure<dbcontextoption> (Options =>2   3  options. ConnectionString =4   user Id=zengxw; password=123456; Host=localhost; Port=5432;database=zxwpgdemo; Pooling=true;   "  5  });  6  services. Addscoped<idbcontextcore, postgresqldbcontext> (); //  inject EF context  
    view code

    Inject codegenerateoption

  3. 1Services. configure<codegenerateoption> (options =2             {3Options. OutputPath ="F:\\test\\postgresql";4Options. Modelsnamespace ="Zxw.Framework.Website.Models";5Options. Irepositoriesnamespace ="Zxw.Framework.Website.IRepositories";6Options. Repositoriesnamespace ="Zxw.Framework.Website.Repositories";7Options. Controllersnamespace ="Zxw.Framework.Website.Controllers";8});
    View Code

    Call Generateallcodesfromdatabase to generate all the code

1 codegenerator.generateallcodesfromdatabase (true);

Summing up and planning work, more with the family to accompany children, more reading more newspapers, more exercise, after all, money is not enough to earn ... If you have a lot of friends can throw all over, haha ha about the plan, but in the long-term persistence, such as the recent plan to rewrite the payment module and the introduction of enterprises. In addition, if there is a private single cooperation or business cooperation, or high-quality job recommendation, 24 hours full Tianquan month all year round always welcome message or private messages ~ ~

"Dotnetcore rapid development framework based on EF Core's code First mode" completes support for the generation of DB first codes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.