S
shapper
Hello,
I am creating a few repositories to work with Entity Framework.
One problem I have is about the naming of the methods. For example:
public interface IAssetRepository {
Asset GetAssetById(Guid id);
Asset GetAssetByName(String name);
IEnumerable<Asset> FindAssets();
IEnumerable<Asset> FindAssetsByCity(String city);
void DeleteAsset(Guid id);
void CreateAsset(Asset asset);
void UpdateAsset(Asset asset);
} // IAssetRepository
Or simpler:
public interface IAssetRepository {
Asset GetAsset(Guid id);
Asset GetAsset(String name);
IEnumerable<Asset> GetAssets();
IEnumerable<Asset> GetAssets(String city);
void Delete(Guid id);
void Create(Asset asset);
void Update(Asset asset);
} // IAssetRepository
This last situation seems cleaner and I use methods that have the same
name but yet different parameters.
I see all kind of examples so I would like to get some advice on how
people usually name the methods.
Or if there is some kind of rule for this ...
Thanks,
Miguel
I am creating a few repositories to work with Entity Framework.
One problem I have is about the naming of the methods. For example:
public interface IAssetRepository {
Asset GetAssetById(Guid id);
Asset GetAssetByName(String name);
IEnumerable<Asset> FindAssets();
IEnumerable<Asset> FindAssetsByCity(String city);
void DeleteAsset(Guid id);
void CreateAsset(Asset asset);
void UpdateAsset(Asset asset);
} // IAssetRepository
Or simpler:
public interface IAssetRepository {
Asset GetAsset(Guid id);
Asset GetAsset(String name);
IEnumerable<Asset> GetAssets();
IEnumerable<Asset> GetAssets(String city);
void Delete(Guid id);
void Create(Asset asset);
void Update(Asset asset);
} // IAssetRepository
This last situation seems cleaner and I use methods that have the same
name but yet different parameters.
I see all kind of examples so I would like to get some advice on how
people usually name the methods.
Or if there is some kind of rule for this ...
Thanks,
Miguel