error CS1593 in netcore."Delegate ... Does not take 1 arguments

asp.net-core c# entity-framework-core faker

Question

I'm trying to seed my database with Bogus and Faker when this error occurs:

error CS1593: Delegate 'Func<Faker, Address, short>' does not take 1 arguments

This is my code snippet and the error starts at the BuildingNumber method.

if (!context.Addresses.Any())
            {
                var faker = new Bogus.DataSets.Address();
                var addressSkeleton = new Faker<Resa.Models.Address>()
                .RuleFor(a => a.Street, f => faker.StreetAddress())
                .RuleFor(a => a.Number, f => faker.BuildingNumber())
                .RuleFor(a => a.Latitude, f => faker.Latitude())
                .RuleFor(a => a.Longitude, f => faker.Longitude())
                .FinishWith((f,a) => {
                    Console.WriteLine("Address created with Bogus: {0}!", a.Street);
                });

According to the documentation found at https://github.com/bchavez/Bogus there should be no parameter in the method.

1
1
11/21/2016 4:09:34 PM

Accepted Answer

I think the source of the problem might be that your "Number" property is type of short and the "BuildingNumber" method returns string instead of short. I am not sure for this answer, just looked your code and Bogus then write down this answer. I hope it helps.

2
11/21/2016 5:55:17 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow