using System;
using System.Reflection;
using System.Linq;
using System.Linq.Expressions;
namespace Infrastructure.Common
{
///
/// Business service .
///
public class BusinessService : IBusinessService
{
///
/// Send service data interface .
///
private ISendServiceData sendService;
///
/// Mark instance.
///
///
public BusinessService(ISendServiceData sendService)
{
this.sendService = sendService;
}
///
/// Send business data to service interface.
///
/// Object author.
/// Method name.
/// Method call parameter.
public void SendBusinessData(object callAuthor, string methodName, object parameterInstance)
{
object result =
callAuthor.GetType().GetMethod(methodName).Invoke(callAuthor, new object[] { parameterInstance });
if (result != null)
{
sendService.Send(result);
}
}
///
/// Send business data to service interface.
///
///
///
///
public void SendBusinessData
(Func
callFun, P parameter)
{
object result = callFun(parameter);
if (result != null)
{
sendService.Send(result);
}
}
}
}
using System;using System.Reflection;using System.Linq;using System.Linq.Expressions;namespace Infrastructure.Common{/// /// Business service ./// publicclass BusinessService : IBusinessService {/// /// Send service data interface ./// private ISendServiceData sendService;/// /// Mark instance./// /// public BusinessService(ISendServiceData sendService) {this.sendService = sendService; }/// /// Send business data to service interface./// /// Object author./// Method name./// Method call parameter.publicvoid SendBusinessData(object callAuthor, string methodName, object parameterInstance) {object result = callAuthor.GetType().GetMethod(methodName).Invoke(callAuthor, newobject[] { parameterInstance });if (result != null) { sendService.Send(result); } }/// /// Send business data to service interface./// /// /// /// publicvoid SendBusinessData
(Func
object
> callFun, P parameter) {object result = callFun(parameter);if (result != null) { sendService.Send(result); } } }}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.Common
{
public interface ISendServiceData
{
void Send(object sendObject);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.Common.Cache
{
[AttributeUsage(AttributeTargets.Class)]
public class EntityCache : EntityOperation
{
public EntityCache(int cacheTime, bool IsEnable)
{
this.ExpireTime = cacheTime;
}
public int ExpireTime { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Infrastructure.Common.Validator
{
public enum ValidatorOperationType
{
Insert,
Delete,
Update,
Select,
All
}
[AttributeUsage(AttributeTargets.Class)]
public class EntityValidator : EntityOperation
{
public EntityValidator(ValidatorOperationType validatorType)
{
}
}
}
namespace DomainModelBehavior.Order.ShippingBehavior
{
using ConsoleApplication1.DomainModel;
public static class OrderBehavior
{
public static Order TaxRate(this Order order)
{
return order;
}
}
}
namespace DomainModelBehavior.Order.ShoppingCart
{
using ConsoleApplication1.DomainModel;
public static class OrderBehavior
{
public static Order Inventory(this Order order)
{
return order;
}
}
}
using System;
namespace ConsoleApplication1
{
using DomainModelBehavior.Order.ShoppingCart;
class Program
{
static void Main(string[] args)
{
DomainModel.Order order = new DomainModel.Order(Guid.NewGuid().ToString());
order.Inventory();
}
}
}
using System;namespace ConsoleApplication1{using DomainModelBehavior.Order.ShoppingCart;class Program {staticvoid Main(string[] args) { DomainModel.Order order = new DomainModel.Order(Guid.NewGuid().ToString()); order.Inventory(); } }}
创建Web工程,使用eclipse ee创建maven web工程 1.右键项目,选择Project Facets,点击Convert to faceted from 2.更改Dynamic Web Module的Version为2.5.(3.0为Java7的,Tomcat6不支持). 如果提示错误,可能需要在Java Compiler设置Compiler compl
最近一直在看python的document,打算在基础方面重点看一下python的keyword、Build-in Function、Build-in Constants、Build-in Types、Build-in Exception这四个方面,其实在看的时候发现整个《The Python Standard Library》章节都是很不错的,其中描述了很多不错的主题。先把Build-in Fu
学习函数式编程
package base;
import java.text.DecimalFormat;
public class Main {
public static void main(String[] args) {
// Integer a = 4;
// Double aa = (double)a / 100000;
// Decimal
Java中的泛型的使用:1.普通的泛型使用
在使用类的时候后面的<>中的类型就是我们确定的类型。
public class MyClass1<T> {//此处定义的泛型是T
private T var;
public T getVar() {
return var;
}
public void setVa