vietnam-devs / coolstore-microservices

A full-stack .NET microservices build on Dapr and Tye
https://vietnam-devs.github.io/coolstore-microservices
MIT License
2.48k stars 581 forks source link

Missing KeyValueObject #49

Closed erapote closed 5 years ago

erapote commented 5 years ago

Hello,

First of all, thanks for this cool project. Been looking to find something like this as a guide on my software development projects (other than using ABP).

This may not actually be an issue but I was trying to have a successful build but the solution fails because KeyValueObject is missing. Can't find it anywhere in code. Please point me in the right direction.

public static class EnumHelper { public static IEnumerable<KeyValueObject> GetEnumKeyValue<TEnum, TKey>() where TKey : class { var metas = GetMetadata<TEnum, TKey>(); var results = metas.Item1.Zip(metas.Item2, (key, value) => new KeyValueObject ( key, value ) ); return results; }

    public static (IEnumerable<TKey>, IEnumerable<string>) GetMetadata<TEnum, TKey>()
    {
        var keyArray = (TKey[])Enum.GetValues(typeof(TEnum));
        var nameArray = Enum.GetNames(typeof(TEnum));

        var keys = new List<TKey>();
        foreach (var item in keyArray) keys.Add(item);

        var names = new List<string>();
        foreach (var item in nameArray) names.Add(item);

        return (keys, names);
    }
}

Thank you very much.

thangchung commented 5 years ago

Thank you for finding it. I have never noticed about this missing before. I have fixed it. Feel free to open if it still happens

erapote commented 5 years ago

Thank you very much! :)

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.