Code Monkey home page Code Monkey logo

Comments (8)

pavel-b-novikov avatar pavel-b-novikov commented on August 25, 2024

Have you also exported base classes/interfaces?

from reinforced.typings.

d-dantte avatar d-dantte commented on August 25, 2024

Yes i did. I'll just go ahead and drop my entire code here for you to see.
Thanks for the speedy response.

public static class ReinforcedTypings
{
    public static void Configure(ConfigurationBuilder config)
    {
        var polluxBase = typeof(PolluxEntity<>);

        var types = new[] { polluxBase }.Concat(
        polluxBase
            .Assembly
            .GetTypes()
            .Where(_t => _t.IsClass)
            .Where(_t => _t != polluxBase)
            .Where(_t => _t.HasGenericAncestor(polluxBase))); //filters classes who's generic ancestor has the argument as it's generic definition
            
        config.ExportAsInterfaces(types, _icb =>
        {
            _icb.OverrideNamespace("Pollux.Models")
                .WithPublicProperties();
        });
    }
}

Examples of classes being exported are below

public abstract class PolluxEntity<Key>
{
    public Key EntityId { get; set; }

    public DateTime CreatedOn { get; set; }

    public DateTime? ModifiedOn { get; set; }


    public PolluxEntity()
    {
        this.CreatedOn = DateTime.Now;
    }
}


public class ContactData: PolluxEntity<long>
{
    public string Phone  { get; set; }
    public string AlternatePhone  { get; set; }
    public bool PhoneConfirmed { get; set; }

    public string Email  { get; set; }
    public string AlternateEmail  { get; set; }
    public bool EmailConfirmed  { get; set; }
    
    public virtual string OwnerId  { get; set; }

    public ContactData()
    {
    }
}

...and many other such model/entity classes.

But the final result looks like this:


export interface IPolluxEntity<Key>
{
    EntityId: Key;
    CreatedOn: any;
    ModifiedOn?: any;
}
export interface IContactData
{
    Phone: string;
    AlternatePhone: string;
    PhoneConfirmed: boolean;
    Email: string;
    AlternateEmail: string;
    EmailConfirmed: boolean;
    OwnerId: string;
}

I'm wondering what i'm missing...

Many thanks again in advance.

from reinforced.typings.

pavel-b-novikov avatar pavel-b-novikov commented on August 25, 2024

Ok, I will check little bit later. Now I dont have enough time

from reinforced.typings.

pavel-b-novikov avatar pavel-b-novikov commented on August 25, 2024

Ok, your issue is fixed in 1.30 branch. Please check out this branch and run your test.

from reinforced.typings.

d-dantte avatar d-dantte commented on August 25, 2024

Will do.
Cheers.

from reinforced.typings.

pavel-b-novikov avatar pavel-b-novikov commented on August 25, 2024

If you come up with some other cases to test - feel free to add your tests and contribute.
You will speed up release of 1.3 and also improve stability

from reinforced.typings.

d-dantte avatar d-dantte commented on August 25, 2024

I'll be glad to.

from reinforced.typings.

pavel-b-novikov avatar pavel-b-novikov commented on August 25, 2024

Fixed in 1.3.0

from reinforced.typings.

Related Issues (20)

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.