public long CreateUser(string name) { var entity = new { ID = CFID.NewID(), Name = "张三" }; dbQuery.Execute(DBBuilder.Insert("TCTest", entity)); Console.WriteLine("用户已创建,用户编号:" + entity.ID); return(entity.ID); }
public virtual bool Add(TEntity entity) { if (OnAdd != null) { OnAdd(ref entity); } var fieldAndValues = GetFieldAndValue(entity, true); if (!fieldAndValues.ContainsKey(_entityDefinition.Value.TableAttribute.PrimaryKey)) { entity.ID = CFID.NewID(); fieldAndValues[_entityDefinition.Value.TableAttribute.PrimaryKey] = entity.ID; } var dbBuilder = DBBuilder.Insert(_entityDefinition.Value.TableAttribute.TableName, fieldAndValues); int result = this.UnitOfWork.Execute(dbBuilder); return(result > 0); }
public Message() { this.ID = CFID.NewID(); this.TypeName = this.GetType().FullName; this.Timestamp = DateTime.Now; }