question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Non-Generic Generate support

See original GitHub issue

Can we add static non-generic counterparts for the Generate methods that accept a Type to the AutoFaker class?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jvmletcommented, Mar 7, 2023

@nickdodd79 , would you accept such PR to AutoGenerateContextExtensions ?

public static object Generate(this AutoGenerateContext context,Type typeToGenerate)
    {
      if (context != null)
      {
        // Set the generate type for the current request
        context.GenerateType =typeToGenerate;

        // Get the type generator and return a value
        var generator = AutoGeneratorFactory.GetGenerator(context);
        return generator.Generate(context);
      }

      return default;
    }
1reaction
nickdodd79commented, Nov 24, 2021

Hey @gkruszewski

Shouldn’t be difficult to add non-generic support. I will see what I can do.

Nick.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Is generic constructor in non-generic class supported?
No, generic constructors aren't supported in either generic or non-generic classes. Likewise generic events, properties and finalizers ...
Read more >
DispatchProxy needs a non-generic Create API #28419
Currently DispatchProxy just provides the following Generic API to create a proxy : public static T Create<T, TProxy>() {..}.
Read more >
What to do, if I need non generic class use generic inside ...
Create a class named Footer (not generic). Change your Page.footer to this type: class Page { Header header; Body body; Footer footer; ...
Read more >
Generics in .NET
Define & use generics, learn their advantages & drawbacks, understand class library & language support, and more.
Read more >
Non-generic Vs Generic Collection in Java
there are certain advantages of generics over non-generic are as follows: Code Reuse: With help of Generics, one needs to write a method/class/ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found