EntityFramework-Reverse-POCO-Code-First-Generator icon indicating copy to clipboard operation
EntityFramework-Reverse-POCO-Code-First-Generator copied to clipboard

There should be point to extend object filtration

Open emanov opened this issue 9 years ago • 3 comments

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.

emanov avatar Sep 21 '16 09:09 emanov

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

sjh37 avatar Sep 21 '16 10:09 sjh37

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.

emanov avatar Sep 22 '16 09:09 emanov

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.

agentKnipe avatar Nov 09 '20 21:11 agentKnipe