GithubHelp home page GithubHelp logo

ascargb / anchormodelingframework Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 45 KB

Implementation of the anchor modeling for Entity Framework Core as a Fody plugin

C# 100.00%
ilweaving fody cecil aop entity-framework-core anchor-modeling

anchormodelingframework's Introduction

AnchorModelingFramework

Implementation of the anchor modeling for Entity Framework Core as a Fody plugin.

AnchorModeling.Fody

NuGet

AnchorModeling.Libraries

NuGet

AnchorModeling.Extensions

NuGet

Quick start tutorial

The example uses Visual Studio 2019

First you need to create a database model as in this example

Next install the following packages:

<ItemGroup>
    <PackageReference Include="AnchorModeling.Fody" Version="0.9.5" />
    <PackageReference Include="AnchorModeling.Libraries" Version="0.9.5" />
    <PackageReference Include="Fody" Version="6.1.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />   
  </ItemGroup>

Make sure the FodyWeavers.xml file is added:

<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <AnchorModeling />
</Weavers>

Now rebuild the project. In the output you will see:

1>    Fody/AnchorModeling:   Constructing entities...
1>    Fody/AnchorModeling:   Take entity: User
1>    Fody/AnchorModeling:   Make ancor: A_Users
1>    Fody/AnchorModeling:   Make attribute: P_Users_Name
1>    Fody/AnchorModeling:   Take entity: Computer
1>    Fody/AnchorModeling:   Make ancor: A_Computers
1>    Fody/AnchorModeling:   Take entity: MotherBoard
1>    Fody/AnchorModeling:   Make ancor: A_MotherBoards
1>    Fody/AnchorModeling:   Make attribute: P_MotherBoards_Name
1>    Fody/AnchorModeling:   Take entity: Processor
1>    Fody/AnchorModeling:   Make ancor: A_Processors
1>    Fody/AnchorModeling:   Make attribute: P_Processors_Name
1>    Fody/AnchorModeling:   Take entity: RAM
1>    Fody/AnchorModeling:   Make ancor: A_RAMs
1>    Fody/AnchorModeling:   Make attribute: P_RAMs_Name
1>    Fody/AnchorModeling:   Take entity: SoundCard
1>    Fody/AnchorModeling:   Make ancor: A_SoundCards
1>    Fody/AnchorModeling:   Make attribute: P_SoundCards_Name
1>    Fody/AnchorModeling:   Take entity: VideoCard
1>    Fody/AnchorModeling:   Make ancor: A_VideoCards
1>    Fody/AnchorModeling:   Make attribute: P_VideoCards_Name
1>    Fody/AnchorModeling:   Make attribute: P_VideoCards_Bytes
1>    Fody/AnchorModeling:   Make tie: T_H_Users_HomeComputer_to_Computers
1>    Fody/AnchorModeling:   Make tie: T_H_Users_WorkComputer_to_Computers
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_MotherBoard_to_MotherBoards
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_Processor_to_Processors
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_RAM1_to_RAMs
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_RAM2_to_RAMs
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_SoundCard_to_SoundCards
1>    Fody/AnchorModeling:   Make tie: T_H_Computers_VideoCard_to_VideoCards

These are the new types that have been added to the assembly.

Now create a console application and add a link to the project with the model and the AnchorModeling.Libraries package.

Then unload the project with the model

When you insert data into your entities, the data will be automatically saved in the anchor model. See an example.

anchormodelingframework's People

Contributors

ascargb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.