sjh37 / EntityFramework-Reverse-POCO-Code-First-Generator

EntityFramework Reverse POCO Code First Generator - Beautifully generated code that is fully customisable. This generator creates code as if you reverse engineered a database and lovingly created the code by hand. It is free to academics (you need a .edu or a .ac email address), not free for commercial use. Obtain your licence from
https://www.reversepoco.co.uk/
Other
710 stars 227 forks source link

There should be point to extend object filtration #119

Open emanov opened 8 years ago

emanov commented 8 years ago

Hello!

I have wrote already about 1-12 years ago about filtration of objects. With our databases that have several schemas and objects with the same name in different schemas it's work poor. So it's highly preferrable give users a point to extend filtration by interface, something like: public interface IObjectFilter { bool IsTableIncluded(string schema, string name); bool IsProcIncluded(string schema, string name); } because of filtration is used deeply in the core and requires a big changes to swith from one of the implementation to another.

for this interface I would use my object filter attached in the file (it could be the one of the extensions for the code generator.

Then if user want to use this object filter there is neccesary only to include it;

<#@ include file="$(SolutionDir)SolutionItems\EF.Reverse.POCO.Core.ttinclude" #>
<#@ include file="$(SolutionDir)SolutionItems\EF.Reverse.POCO.ObjectFilter.ttinclude" #>

and setup it

    FilterInclude
        .Schema("dbo")
        .Table("JV_CHANNEL", "JV_SERVICE_NUMBER_GOODS", "JV_GOODS");

or

    FilterInclude.Schema("sbsc").AllProcs()

EF.Reverse.POCO.ObjectFilter.txt

For the current filtration there should be very simple implementation of the IObjectFilter.

sjh37 commented 8 years ago

This is a better filter system than the one I have, so will incorporate it. Many thanks.

emanov commented 8 years ago

Nice news!

That is example of usage: FilterInclude.Schema("Configuration").Tables(""); FilterInclude.Schema("Document").Tables("^PartnerRequest.", "^FundsProvider.", "^FundsSource.", "^Bank.")

FilterInclude.Schema("Commerce")
    .Table(
           "Agreement",
           "BankDetailsSet",
           "CalculationSchema",
           "ComPolicyServiceCategory",
           "LegalEntity",
           "PartnerAgreement",
           "UserDiscountReason"
           );

The classes Filter, Schema - tested in our production The class ObjectFilter - is not tested because I've just create it to expose interface. I still think that filtration interface is a good thing to make it possible to use own filtration system even if the filtration system above will be incorporated.

Thanks again.

agentKnipe commented 4 years ago

Does this style filtering work with the v3 .net core tt file? ive run into a situation where I want tables from dbo, but stored procedures from another schema, but not the procedures that are in dbo.