您好,非常感謝您的幫助。幫助c#模式
using .Net 3.5 C#;
說我有大約10的方法,所有遵循相同的模式
使用3爲例:
public Customer CreateCustomer(Customer c) { .. }
public Car CreateCar(Car c) { .. }
public Planet CreatePlanet(Planet p) { ..}
每個方法的內部邏輯具有完全相同的模式。
IE:
public Customer CreateCustomer(Customer c)
{
Log.BeginRequest(c, ActionType.Create);
Validate(customer);
WebService.Send(Convert(c));
Log.EndRequest(c, ActionType.Create);
}
public Car CreateCar(Car c)
{
Log.BeginRequest(c, ActionType.Create);
Validate(c);
WebService.Send(Convert(c));
Log.EndRequest(c, ActionType.Create);
}
同樣是與CreatePlanet和其他7分的方法實現。
這些方法是否可以重寫,它們都遵循相同的模式,我覺得我錯過了一些東西......是否還有另一個抽象層次可以派生出來?
問題:應該如何重寫以利用正確的架構模式?
感謝, 史蒂芬
是通用能夠解決你的問題嗎? – Benny 2009-11-28 17:01:33