// No argument CTOR. By deafult Parser's ctor requires scanner as param. public Parser(Scanner scn, StatementFactory codegen) : base(scn) { this.codegen = codegen; program = codegen.NewList(); currentStatement = new Stack <IStatement>(); }
internal CqlUpdate(Expression expression, ITable table, StatementFactory stmtFactory, PocoData pocoData, MapperFactory mapperFactory) : base(expression, table, stmtFactory, pocoData) { _mapperFactory = mapperFactory; }
internal CqlQueryBase(Expression expression, ITable table, MapperFactory mapperFactory, StatementFactory stmtFactory, PocoData pocoData) { InternalInitialize(expression, table, mapperFactory, stmtFactory, pocoData); }
public virtual Task <int?> InsertGetIdAsync(T obj) => GeneratedNonQueryGetIdAsync(StatementFactory.Insert <T>().Build(obj));
internal CqlQuery(Expression expression, ITable table, MapperFactory mapperFactory, StatementFactory stmtFactory, PocoData pocoData) : base(expression, table, mapperFactory, stmtFactory, pocoData) { }
private protected override SelectStatementBuilder <RaceData> DefaultSelectQuery() => StatementFactory.Select <RaceData>().Join <RaceData, EventType>((nameof(RaceData.EventTypeId), nameof(EventType.Id)));
private protected override SelectStatementBuilder <SkierEvent> DefaultSelectQuery() => StatementFactory.Select <SkierEvent>() .Join <SkierEvent, RaceData>((nameof(SkierEvent.RaceDataId), nameof(RaceData.Id)))
public DriveParser(ResourceFactory resourceFactory, StatementFactory statementFactory) { itsResourceFactory = resourceFactory; itsStatementFactory = statementFactory; itsDereferencer = new SimpleDereferencer(); }
/// <summary> /// Assign the factory the parser must use to create statements from resources /// </summary> public void SetStatementFactory(StatementFactory statementFactory) { itsStatementFactory = statementFactory; }
private protected virtual SelectStatementBuilder <T> DefaultSelectQuery() => StatementFactory.Select <T>();
public GenderDao( IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory,"hurace.Gender", statementFactory) { }
protected ReadonlyDao(IConnectionFactory connectionFactory, string tableName, StatementFactory statementFactory) : base(connectionFactory, tableName, statementFactory) { }
public bool WasMakeParserCalledWith(ResourceFactory resourceFactory, StatementFactory statementFactory) { return(itsMethodCalls.WasMethodCalledWith("MakeParser", resourceFactory, statementFactory)); }
public Parser MakeParser(ResourceFactory resourceFactory, StatementFactory statementFactory) { itsMethodCalls.RecordMethodCall("MakeParser", resourceFactory, statementFactory); return(new ParserStub()); }
internal CqlScalar(Expression expression, ITable table, StatementFactory stmtFactory, PocoData pocoData) : base(expression, table, null, stmtFactory, pocoData) { }
public SensorDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory, "hurace.sensor", statementFactory) { }
public RaceDataDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory, "hurace.RaceData", statementFactory) { }
public override async Task <bool> InsertAsync(TimeData obj) => await GeneratedNonQueryAsync(StatementFactory.Insert <TimeData>().WithKey().Build(obj));
public SkierEventDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory, "hurace.SkierEvent", statementFactory) { }
/// <summary> /// Clears all the mapping defined for this instance /// </summary> internal void Clear() { _typeDefinitions = new LookupKeyedCollection<Type, ITypeDefinition>(td => td.PocoType); MapperFactory = new MapperFactory(_typeConverter, new PocoDataFactory(_typeDefinitions)); StatementFactory = new StatementFactory(); }
protected DefaultCrudDao(IConnectionFactory connectionFactory, string tableName, StatementFactory statementFactory) : base(connectionFactory, tableName, statementFactory) { }
public Parser MakeParser(ResourceFactory resourceFactory, StatementFactory statementFactory) { return(new ParserStub()); }
internal CqlDelete(Expression expression, ITable table, StatementFactory stmtFactory, PocoData pocoData) : base(expression, table, stmtFactory, pocoData) { }
protected BaseDao(IConnectionFactory connectionFactory, string tableName, StatementFactory statementFactory) { StatementFactory = statementFactory; TableName = tableName; ConnectionFactory = connectionFactory; }
private static async Task GenerateEditableWrappers() { string baseDirectory = Path.GetFullPath( Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), @"..\..\..\..")); ProjectWithCodeAnalysis project = await ProjectWithCodeAnalysis.OpenAsync( Path.Combine(baseDirectory, @"CSharpDom\CSharpDom.csproj")); project.Lock(); foreach (DocumentWithCodeAnalysis document in project.Documents.OrderBy(document => document.FullFilePath)) { document.IsLocked = true; string filePath = document.FullFilePath; if (!filePath.Contains(@"CSharpDom\BaseClasses\Wrappers")) { continue; } string newDirectory = Path.GetDirectoryName(filePath) .Replace(@"CSharpDom\BaseClasses\Wrappers", @"CSharpDom\BaseClasses\Editable\Wrappers"); string destinationPath = Path.Combine(newDirectory, GetNewName(Path.GetFileName(filePath))); if (File.Exists(destinationPath)) { continue; } LoadedDocumentWithCodeAnalysis loadedDocument = await document.LoadAsync(); NamespaceWithCodeAnalysis @namespace = loadedDocument.Namespaces.First(); Console.WriteLine($"Writing: {Path.GetFileName(destinationPath)}"); string namespaceName = @namespace.Name; using (CodeAnalysisSettings.AllowEdits(loadedDocument)) { foreach (UsingDirectiveWithCodeAnalysis directive in loadedDocument.UsingDirectives) { directive.Name = directive.Name.Replace("CSharpDom.Common", "CSharpDom.Common.Editable"); } loadedDocument.UsingDirectives.Add(new UsingDirectiveWithCodeAnalysis("CSharpDom.Common")); loadedDocument.UsingDirectives = loadedDocument.UsingDirectives .OrderBy(directive => directive.Name) .ToArray(); @namespace.Name = "CSharpDom.BaseClasses.Editable.Wrappers"; SealedClassWithCodeAnalysis @class = @namespace.Classes.SealedClasses.First(); @class.Name = "Editable" + @class.Name; @class.BaseClass.Name = Regex.Replace(@class.BaseClass.Name, "^Abstract", "Editable"); ITypeReferenceWithCodeAnalysis interfaceReference = @class.ImplementedInterfaces.First().GenericParameters[0]; interfaceReference.Name = Regex.Replace(interfaceReference.Name, "^I", "IEditable"); foreach (GenericParameterDeclarationWithCodeAnalysis genericParameter in @class.GenericParameters) { InterfaceReferenceWithCodeAnalysis constraint = genericParameter.InterfaceConstraints.First(); constraint.Name = Regex.Replace(constraint.Name, "^I", "IEditable"); } ITypeReferenceWithCodeAnalysis constructorParameterType = @class.Constructors.First().Parameters[0].ParameterType; constructorParameterType.Name = Regex.Replace(constructorParameterType.Name, "^I", "IEditable"); foreach (SealedClassAutoPropertyWithCodeAnalysis property in @class.Properties.AutoProperties) { if (property.Name == "WrappedObject") { //CodeAnalysisLogger.StartLoggingDebugMessages(); property.PropertyType.Name = Regex.Replace(property.PropertyType.Name, "^I", "IEditable"); //string[] logMessages = CodeAnalysisLogger.GetDebugLogMessages(); //CodeAnalysisLogger.StopLoggingDebugMessages(); break; } } foreach (SealedClassPropertyWithCodeAnalysis property in @class.Properties) { string propertyName = property.Name; if (propertyName == "WrappedObject") { continue; } string propertyTypeName = property.PropertyType.Name; if (propertyTypeName.Contains("ReadOnly")) { property.PropertyType.Name = propertyTypeName.Replace("ReadOnly", string.Empty); } IExpressionWithCodeAnalysis expression = ExpressionFactory.Binary( ExpressionFactory.Member(ExpressionFactory.Identifier("WrappedObject"), propertyName), BinaryOperatorExpressionType.Assign, ExpressionFactory.Identifier("value")); property.SetAccessor = new ClassAccessorWithCodeAnalysis( AccessorType.Set, new MethodBodyWithCodeAnalysis(StatementFactory.Expression(expression))); } Directory.CreateDirectory(Path.GetDirectoryName(destinationPath)); const int maximumLineLength = 120; string sourceCode = loadedDocument.ToSourceCode( new IndentBaseTypeListIfTooLongRule(maximumLineLength), new IndentGenericParamterDefinitionsIfTooLongRule(maximumLineLength), new IndentMethodParametersIfTooLongRule(maximumLineLength)); File.WriteAllText(destinationPath, sourceCode); } } }
public SeasonDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory, "hurace.season", statementFactory) { }
public DisciplineDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base( connectionFactory, "hurace.discipline", statementFactory) { }
/// <summary> /// 获取实体集合 /// </summary> /// <returns></returns> public override List <TEntity> GetAllList() { return(_dbContext.connection.Query <TEntity>(StatementFactory.Select <TEntity>(Dialect.MSSQL)).ToList()); }
internal void InternalInitialize(Expression expression, ITable table, MapperFactory mapperFactory, StatementFactory stmtFactory, PocoData pocoData) { Expression = expression; Table = table; MapperFactory = mapperFactory; StatementFactory = stmtFactory; PocoData = pocoData; }
public LocationDao(IConnectionFactory connectionFactory, StatementFactory statementFactory) : base(connectionFactory, "hurace.location", statementFactory) { }