public BackupDatabaseCommand(ICommandPerformer<string> exec, Document value) { this.backupFolder = value.Settings.Keys.Any(x => x == Keys.BackupFolder) ? value.Settings[Keys.BackupFolder] : null; this.restoreFolder = value.Settings.Keys.Any(x => x == Keys.RestoreFolder) ? value.Settings[Keys.RestoreFolder] : null; this.database = value.Name; this.commmandExecutor = exec; }
public CreateTableCommand(ICommandPerformer<string> exec, Entity value) { this.database = value.Schema.Name; this.schema = value.Settings[Keys.Namespace]; this.table = value.Name; this.columns = value.Properties.Select(x => { var result = new List<string> { x.Name, x.PropertyType }; if (x.Settings.ContainsKey(Keys.Identity)) { result.Add(Keys.Identity + x.Settings[Keys.Identity]); } if (x.Settings.ContainsKey(Keys.IsNotSupportNull) && x.Settings[Keys.IsNotSupportNull].ToBoolean()) { result.Add("NOT NULL"); } else { result.Add("NULL"); } return result.ToArray(); }).ToArray(); this.commmandExecutor = exec; }
public CreatePrimaryKeyCommand(ICommandPerformer<string> exec, Property value) { this.database = value.Entity.Schema.Name; this.schema = value.Settings[Keys.Namespace]; this.table = value.Entity.Name; this.field = value.Name; this.executor = exec; }
public void Handle_CommandNotParsed_DoesNothing() { ICommandPerformer commandPerformer = null; this.commandParser.Setup( p => p.TryGetCommandPerformer(UnparsedCommand, out commandPerformer)).Returns(false); this.commandHandler.Handle(UnparsedCommand); }
public InsertDataCommand(ICommandPerformer<string> exec, ICache cache, ITypeMapper mapper, EntityData value) { this.value = value; this.cache = cache; this.executor = exec; this.schema = cache.Pick<Document>(); this.nameSpace = schema.Settings[Keys.Namespace]; this.mapper = mapper; this.properties = schema.Entities.Single(x => x.Name == value.EntityName).Properties; }
public BulkInsertDataCommand(ICache cache, ICommandPerformer<IBulkInsertDetails> executor, EntityData value) { this.value = value; var database = cache.Pick<Document>(); this.schema = database.Settings[Keys.Namespace]; this.database = database.Name; this.executor = executor; this.properties = database.Entities.Single(x => x.Name == value.EntityName).Properties.Select(x => x.Name).ToList(); this.columnNumber = properties.Count(); }
public CreateForeignKeyCommand(ICommandPerformer<string> exec, Relation value) { this.database = value.Entity.Schema.Name; this.schema = value.Settings[Keys.Namespace]; this.primaryTable = value.PrimaryEntity; this.foreignTable = value.ForeignEntity; this.primaryProperty = value.PrimaryProperty; this.foreignProperty = value.ForeignProperty; this.executor = exec; }
public bool TryGetCommandPerformer( string unparsedCommand, out ICommandPerformer commandPerformer) { if (unparsedCommand == "REPORT") { commandPerformer = this.commandPerformerFactory.CreateReportPerformer(); return(true); } commandPerformer = null; return(false); }
public bool TryGetCommandPerformer( string unparsedCommand, out ICommandPerformer commandPerformer) { foreach (var commandParser in this.commandParsers) { if (commandParser.TryGetCommandPerformer(unparsedCommand, out commandPerformer)) { return(true); } } commandPerformer = null; return(false); }
public bool TryGetCommandPerformer( string unparsedCommand, out ICommandPerformer commandPerformer) { var placeAndState = unparsedCommand.Split(' '); if (placeAndState.Length != 2 || placeAndState[0] != "PLACE") { commandPerformer = null; return(false); } var unparsedState = placeAndState[1].Split(','); if (unparsedState.Length != 3) { commandPerformer = null; return(false); } int xCoordinate; if (!int.TryParse(unparsedState[0], out xCoordinate)) { commandPerformer = null; return(false); } int yCoordinate; if (!int.TryParse(unparsedState[1], out yCoordinate)) { commandPerformer = null; return(false); } IOrientation orientation; if (!this.orientationParser.TryParse(unparsedState[2], out orientation)) { commandPerformer = null; return(false); } commandPerformer = this.commandPerformerFactory.CreatePlacePerformer( xCoordinate, yCoordinate, orientation); return(true); }
public void PerformWith(ICommandPerformer performer) { performer.SearchTrack(); }
public DeleteDatabaseCommand(ICommandPerformer<string> performaer, Document value) : base(performaer, value) { }
public void PerformWith(ICommandPerformer performer) { performer.ShowPlaylist(); }
public void PerformWith(ICommandPerformer performer) { performer.AddNewTrack(); }
public CreateDatabaseCommand(ICommandPerformer<string> performaer, Document value) { this.database = value.Name; this.commmandExecutor = performaer; }
public void Update(ICommandPerformer commandPerformer) { this.robotState = commandPerformer.Perform(this.robotState); }
public void PerformWith(ICommandPerformer performer) { performer.DeleteTrack(); }