protected override void VisitCreate(CreateBuilder item) { GuardCreateBuilder(item); item.CreateObject.Accept(this); Request = EntityBuilder.ToCreateEntityRequest(); EntityBuilder = null; }
protected override void VisitCreate(CreateBuilder item) { var visitor = new CreateEntityRequestBuilderVisitor(Parameters, CrmMetadataProvider, Settings); IVisitableBuilder visitable = item; visitable.Accept(visitor); SetOperation(visitor.GetCommand()); }
public void ShouldCreateCharColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[7]); sql.Should().Be("[Char] [char(10)] NOT NULL,"); }
public void ShouldCreateCustomColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[10]); sql.Should().Be("[Custom] [varchar(50)] IDENTITY(1,1) NULL,"); }
public void ShouldCreateDateTimeColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[2]); sql.Should().Be("[DateTime] [datetime] NOT NULL,"); }
public void ShouldCreateDecimalColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[6]); sql.Should().Be("[Decimal] [decimal(18, 0)] NOT NULL,"); }
public void ShouldCreateBigIntColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[9]); sql.Should().Be("[Int64] [bigint] NOT NULL,"); }
public void ShouldCreateBoolColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[4]); sql.Should().Be("[Boolean] [bit] NOT NULL,"); }
/// <summary> /// 生成实体、服务、Api /// </summary> /// <param name="model"></param> /// <returns></returns> public async Task <ApiResult <string> > CreateCode(CreateBuilder model) { await Task.Run(() => _toolService.CreateModel(model)); await Task.Run(() => _toolService.CreateService(model)); await Task.Run(() => _toolService.CreateApi(model)); return(new ApiResult <string>()); }
private void GuardCreateBuilder(CreateBuilder builder) { if (builder == null) { throw new ArgumentNullException("builder"); } if (builder.CreateObject == null) { throw new ArgumentException("The create statement must specify a supported object to create, i.e a database or a table."); } // could check if the create object is database and make sure it has a name, // could check if the create object is a table and make sure it has the id columnd and name column specified. }
/// <summary>Create a directory.</summary> /// <remarks>Create a directory. It is not an error if it already exists</remarks> /// <param name="path">path to create</param> /// <param name="mode">mode for path</param> /// <param name="createParents">flag to trigger parent creation</param> /// <param name="acls">ACL for path</param> /// <exception cref="System.IO.IOException">any problem</exception> public virtual bool ZkMkPath(string path, CreateMode mode, bool createParents, IList <ACL> acls) { CheckServiceLive(); path = CreateFullPath(path); if (acls == null || acls.IsEmpty()) { throw new NoPathPermissionsException(path, "Empty ACL list"); } try { RegistrySecurity.AclListInfo aclInfo = new RegistrySecurity.AclListInfo(acls); if (Log.IsDebugEnabled()) { Log.Debug("Creating path {} with mode {} and ACL {}", path, mode, aclInfo); } CreateBuilder createBuilder = curator.Create(); createBuilder.WithMode(mode).WithACL(acls); if (createParents) { createBuilder.CreatingParentsIfNeeded(); } createBuilder.ForPath(path); } catch (KeeperException.NodeExistsException e) { if (Log.IsDebugEnabled()) { Log.Debug("path already present: {}", path, e); } return(false); } catch (Exception e) { throw OperationFailure(path, "mkdir() ", e, acls); } return(true); }
public JsonAstBuilder() { var token = new CreateBuilder <JsonToken>(); var jobject = Create("object", () => new JsonObject()); jobject.Children().HasKeyValue <JsonObject, string, JsonToken>( new ValueBuilder { Name = "name" }, token ); var jarray = Create("array", () => new JsonArray()); jarray.Children().HasMany <JsonArray, JsonToken>().Builders.Add(token); token.Create("string", () => new JsonValue()).Property <string>((o, v) => o.Value = v); token.Builders.Add(jobject); token.Builders.Add(jarray); token.Create("number", () => new JsonValue()).Property <decimal>((o, v) => o.Value = v); token.Create("bool", () => new JsonValue()).Property <bool>((o, v) => o.Value = v); token.Create(() => (JsonToken)null); }
internal static T CreateObject <T>(TypeInfo typeInfo, CommandService commands, IServiceProvider services = null) => CreateBuilder <T>(typeInfo, commands)(services);
internal static T CreateObject <T>(TypeInfo typeInfo, CommandService service, IDependencyMap map = null) => CreateBuilder <T>(typeInfo, service)(map);
public async Task <ApiResult <string> > Get([FromQuery] CreateBuilder param) => await _builderService.CreateCode(param);
public void ShouldCreateGuidColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[3]); sql.Should().Be("[Guid] [uniqueidentifier] NOT NULL,"); }
internal static T CreateObject(TypeInfo typeInfo, InteractionService commandService, IServiceProvider services = null) => CreateBuilder(typeInfo, commandService)(services);
public void ShouldCreateIntColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[0]); sql.Should().Be("[Id] [int] IDENTITY(1,1) NOT NULL,"); }
public void ShouldCreateFloatColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[5]); sql.Should().Be("[Float] [float] NOT NULL,"); }
public void ShouldCreateStringColumn() { var properties = new AllTypes().GetProperties().ToArray(); var builder = new CreateBuilder(); var sql = builder.GetColumnDetails(properties[1]); sql.Should().Be("[Name] [varchar](max) NULL,"); }
public void ShouldReturnFalseForNonPrimaryKey() { var builder = new CreateBuilder(); builder.CreateTable<NoKey>(); builder.ToString().Should().NotContain("CLUSTERED "); }
public void ShouldReturnTrueForPrimaryKey() { var builder = new CreateBuilder(); builder.CreateTable<Person>(); builder.ToString().Should().Contain("CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED "); }
protected override void VisitCreate(CreateBuilder item) { var visitor = new CreateEntityRequestBuilderVisitor(Parameters, CrmMetadataProvider, Settings); IVisitableBuilder visitable = item; visitable.Accept(visitor); SetOperation(visitor.GetCommand()); }
public void ShouldThrowIfPrimaryKeyNotInt() { var builder = new CreateBuilder(); Action action = builder.CreateTable<InvalidKey>; action.ShouldThrow<InvalidKeyException>(); }