<ItemGroup>
<PackageReference Include="Bogus" Version="35.4.0" />
<PackageReference Include="SoapCore" Version="1.1.0.41" />
</ItemGroup>
[DataContract]
public class PersonContract
{
[DataMember] public int Id { get; set; }
[DataMember] public Guid UUId { get; set; } = Guid.NewGuid();
[DataMember] public string Name { get; set; } = string.Empty;
[DataMember] public string Surname { get; set; } = string.Empty;
}
[ServiceContract]
public interface IPersonService
{
[OperationContract]
PersonContract GetPerson(int personId);
}
public PersonContract GetPerson(int personId)
{
var data = DataHelper.GeneratePersonData(100);
return data.FirstOrDefault(x => x.Id == personId);
}
public static Faker GetFakerInstance(string langIso2)
{
Faker faker = new(langIso2);
return faker;
}
public static IList<PersonContract> GeneratePersonData(int count)
{
var faker = GetFakerInstance("tr");
List<PersonContract> personContracts = [];
for (int i = 0; i < count; i++)
{
personContracts.Add(new()
{
Id = faker.IndexFaker + i,
Name = faker.Person.FirstName,
Surname = faker.Person.LastName
});
}
return personContracts;
}