<file_sep>﻿using System;

public interface IRepository<T> where T:IEntity
{
	public Class1()
	{
	}
}
<file_sep>﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using ConsoleApp1;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1.Tests
{
    [TestClass()]
    public class AuthorRepositoryTests
    {
        [TestMethod()]
        public void FindByIdTest()
        {
            var a = 1;
            var b = 1;
            Assert.AreEqual(a, b);
        }
    }
}<file_sep>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    // the implementation based on the following link
    //https://medium.com/falafel-software/implement-step-by-step-generic-repository-pattern-in-c-3422b6da43fd
    class Program
    {
        static void Main(string[] args)
        {
            // The code provided will print ‘Hello World’ to the console.
            // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app.
            Console.WriteLine("Hello World!");
            IRepository<Author> _authorRepository = new AuthorRepository();
            var result = _authorRepository.FindById(1);
            Console.Write(result.authorName);
            Console.ReadLine();




        }
    }
}
<file_sep>﻿using System;


namespace ConsoleApp1
{ 
[Table("Author")]
public partial class Author : IEntity
{
    public int Id { get; set; }

    public string authorName { get; set; }

    private class TableAttribute : Attribute
    {
        private string v;

        public TableAttribute(string v)
        {
            this.v = v;
        }
    }
}
}
<file_sep>﻿namespace ConsoleApp1
{
    public class Model1
    {
    }
}<file_sep>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class AuthorRepository : IRepository<Author>

    {
        private Model1 _authorContext;

        public AuthorRepository()
        {
            _authorContext = new Model1();
        }

        public IEnumerable<Author> List => new List<Author> {
            {new Author{ Id=1, authorName="ayman"} },
            {new Author{ Id=2, authorName="momo"} }
        };

         public Author FindById(int Id)
        {
            return List.Where(x => x.Id == Id).FirstOrDefault();
        }


    }
}
