public override bool DeepCompare(IMap compareTo) { if (!(Compare(compareTo))) { return(false); } ISourceMap sourceMap = (ISourceMap)compareTo; ITableMap checkTableMap; if (!(this.TableMaps.Count == sourceMap.TableMaps.Count)) { return(false); } foreach (ITableMap tableMap in this.TableMaps) { checkTableMap = sourceMap.GetTableMap(tableMap.Name); if (checkTableMap == null) { return(false); } else { if (!(tableMap.DeepCompare(checkTableMap))) { return(false); } } } return(true); }
/// <summary> /// Enable Debug Adapter Protocol for the running adapter. /// </summary> /// <param name="botAdapter">The <see cref="BotAdapter"/> to enable.</param> /// <param name="port">port to listen on.</param> /// <param name="sourceMap">ISourceMap to use (default will be SourceMap()).</param> /// <param name="breakpoints">IBreakpoints to use (default will be SourceMap()).</param> /// <param name="terminate">Termination function (Default is Environment.Exit().</param> /// <param name="events">IEvents to use (Default is Events).</param> /// <param name="codeModel">ICodeModel to use (default is internal implementation).</param> /// <param name="dataModel">IDataModel to use (default is internal implementation).</param> /// <param name="logger">ILogger to use (Default is NullLogger).</param> /// <returns>The <see cref="BotAdapter"/>.</returns> public static BotAdapter UseDebugger( this BotAdapter botAdapter, int port, ISourceMap sourceMap = null, IBreakpoints breakpoints = null, Action terminate = null, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null) { codeModel = codeModel ?? new CodeModel(); DebugSupport.SourceMap = sourceMap ?? new DebuggerSourceMap(codeModel); return(botAdapter.Use( #pragma warning disable CA2000 // Dispose objects before losing scope (excluding, the object ownership is transferred to the adapter and the adapter should dispose it) new DialogDebugAdapter( port: port, sourceMap: DebugSupport.SourceMap, breakpoints: breakpoints ?? DebugSupport.SourceMap as IBreakpoints, terminate: terminate, events: events, codeModel: codeModel, dataModel: dataModel, logger: logger))); #pragma warning restore CA2000 // Dispose objects before losing scope }
private static T Load <T>(ISourceMap sourceMap, IRefResolver refResolver, Stack <string> paths, string json) { var converters = new List <JsonConverter>(); foreach (var component in components) { var result = component.GetConverters(sourceMap, refResolver, paths); if (result.Any()) { converters.AddRange(result); } } return(JsonConvert.DeserializeObject <T>( json, new JsonSerializerSettings() { SerializationBinder = new UriTypeBinder(), TypeNameHandling = TypeNameHandling.Auto, Converters = converters, Error = (sender, args) => { var ctx = args.ErrorContext; }, ContractResolver = new DefaultContractResolver { NamingStrategy = new CamelCaseNamingStrategy() } })); }
private void EnsureConsistency(Type type, IClassMap classMap) { IContext ctx = this.Context; if (ctx.ReadConsistency.Equals(ConsistencyMode.Pessimistic) || ctx.WriteConsistency.Equals(ConsistencyMode.Pessimistic)) { ISourceMap sourceMap = classMap.GetSourceMap(); if (sourceMap != null) { if (sourceMap.PersistenceType.Equals(PersistenceType.ObjectRelational) || sourceMap.PersistenceType.Equals(PersistenceType.Default)) { ITransaction tx = ctx.GetTransaction(ctx.GetDataSource(sourceMap).GetConnection()); if (tx == null) { if (ctx.WriteConsistency.Equals(ConsistencyMode.Pessimistic)) { throw new WriteConsistencyException( string.Format("A write consistency exception has occurred. An object of type {0} was created outside of a transaction. This is not permitted in a context using Pessimistic WriteConsistency.", type), null); } throw new ReadConsistencyException( string.Format("A read consistency exception has occurred. An object of type {0} was created outside of a transaction. This is not permitted in a context using Pessimistic ReadConsistency.", type), null); } } } } }
public override IEnumerable <JsonConverter> GetConverters(ISourceMap sourceMap, IRefResolver refResolver, Stack <string> paths) { foreach (var converter in new LuisComponentRegistration().GetConverters(sourceMap, refResolver, paths)) { yield return(converter); } }
protected virtual string GetDirectoryForClass(IClassMap classMap) { ISourceMap sourceMap = classMap.GetDocSourceMap(); if (sourceMap == null) { throw new MappingException("Can't find Document Source Map for '" + classMap.GetFullName() + "' in the npersist xml mapping file!"); // do not localize } string directory = sourceMap.DocPath; if (!(Directory.Exists(directory))) { throw new NPersistException("Can't find directory: " + directory); // do not localize } directory += @"\" + classMap.GetFullName(); if (!(Directory.Exists(directory))) { try { Directory.CreateDirectory(directory); } catch (Exception ex) { throw new NPersistException("Could not create directory '" + directory + "': " + ex.Message, ex); // do not localize } } return(directory); }
/// <summary> /// Enable Debug Adapter Protocol for the running adapter. /// </summary> /// <param name="botAdapter">The <see cref="BotAdapter"/> to enable.</param> /// <param name="port">port to listen on.</param> /// <param name="sourceMap">ISourceMap to use (default will be SourceMap()).</param> /// <param name="breakpoints">IBreakpoints to use (default will be SourceMap()).</param> /// <param name="terminate">Termination function (Default is Environment.Exit().</param> /// <param name="events">IEvents to use (Default is Events).</param> /// <param name="codeModel">ICodeModel to use (default is internal implementation).</param> /// <param name="dataModel">IDataModel to use (default is internal implementation).</param> /// <param name="logger">ILogger to use (Default is NullLogger).</param> /// <param name="coercion">ICoercion to use (default is internal implementation).</param> /// <returns>The <see cref="BotAdapter"/>.</returns> public static BotAdapter UseDebugger( this BotAdapter botAdapter, int port, ISourceMap sourceMap = null, IBreakpoints breakpoints = null, Action terminate = null, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null) { codeModel = codeModel ?? new CodeModel(); DebugSupport.SourceMap = sourceMap ?? new DebuggerSourceMap(codeModel); return(botAdapter.Use( new DialogDebugAdapter( port: port, sourceMap: DebugSupport.SourceMap, breakpoints: breakpoints ?? DebugSupport.SourceMap as IBreakpoints, terminate: terminate, events: events, codeModel: codeModel, dataModel: dataModel, logger: logger))); }
public override void DeepMerge(IMap mapObject) { Copy(mapObject); ISourceMap sourceMap = (ISourceMap)mapObject; ITableMap tableMap; ITableMap checkTableMap; ArrayList remove = new ArrayList(); foreach (ITableMap iTableMap in this.TableMaps) { checkTableMap = sourceMap.GetTableMap(iTableMap.Name); if (checkTableMap == null) { checkTableMap = (ITableMap)iTableMap.DeepClone(); checkTableMap.SourceMap = sourceMap; } else { iTableMap.DeepMerge(checkTableMap); } } foreach (ITableMap iTableMap in sourceMap.TableMaps) { tableMap = this.GetTableMap(iTableMap.Name); if (tableMap == null) { remove.Add(iTableMap); } } foreach (ITableMap iTableMap in remove) { sourceMap.TableMaps.Remove(iTableMap); } }
public virtual void SetSourceMap(ISourceMap value) { m_SourceMap = value; foreach (IColumnMap columnMap in m_ColumnMaps) { columnMap.SetTableMap(this); } }
public override void DeepCopy(IMap mapObject) { ISourceMap sourceMap = (ISourceMap)mapObject; sourceMap.TableMaps.Clear(); Copy(sourceMap); DoDeepCopy(sourceMap); }
public virtual IDataSource GetDataSource(object obj, string propertyName) { IClassMap classMap = this.Context.DomainMap.MustGetClassMap(obj.GetType()); IPropertyMap propertyMap = classMap.MustGetPropertyMap(propertyName); ISourceMap sourceMap = propertyMap.GetSourceMap(); string name = sourceMap.Name; return((IDataSource)m_hashDataSources[name]); }
protected virtual void DoDeepCopy(ISourceMap sourceMap) { ITableMap cloneTableMap; foreach (ITableMap tableMap in this.TableMaps) { cloneTableMap = (ITableMap)tableMap.DeepClone(); cloneTableMap.SourceMap = sourceMap; } }
public ComposerBot(string rootDialogFile, ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, ISourceMap sourceMap) { this.conversationState = conversationState; this.userState = userState; this.dialogState = conversationState.CreateProperty <DialogState>("DialogState"); this.sourceMap = sourceMap; this.resourceExplorer = resourceExplorer; this.rootDialogFile = rootDialogFile; LoadRootDialogAsync(); }
public DialogDebugAdapter(int port, ISourceMap sourceMap, IBreakpoints breakpoints, Action terminate, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null) : base(logger) { this.events = events ?? new Events<DialogEvents>(); this.codeModel = codeModel ?? new CodeModel(); this.dataModel = dataModel ?? new DataModel(coercion ?? new Coercion()); this.sourceMap = sourceMap ?? throw new ArgumentNullException(nameof(sourceMap)); this.breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints)); this.terminate = terminate ?? new Action(() => Environment.Exit(0)); this.task = ListenAsync(new IPEndPoint(IPAddress.Any, port), cancellationToken.Token); }
public override IEnumerable <JsonConverter> GetConverters(ISourceMap sourceMap, IRefResolver refResolver, Stack <string> paths) { yield return(new InterfaceConverter <Dialog>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <IStorage>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <IRecognizer>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <Recognizer>(refResolver, sourceMap, paths)); yield return(new ActivityConverter()); }
public ComposerBot(string rootDialogFile, ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, ISourceMap sourceMap, IBotTelemetryClient telemetryClient) { this.conversationState = conversationState; this.userState = userState; this.dialogState = conversationState.CreateProperty <DialogState>("DialogState"); this.sourceMap = sourceMap; this.resourceExplorer = resourceExplorer; this.rootDialogFile = rootDialogFile; this.telemetryClient = telemetryClient; DeclarativeTypeLoader.AddComponent(new QnAMakerComponentRegistration()); LoadRootDialogAsync(); }
public override IEnumerable <JsonConverter> GetConverters(ISourceMap sourceMap, IRefResolver refResolver, Stack <string> paths) { yield return(new InterfaceConverter <OnCondition>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <TestAction>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <EntityRecognizer>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <ITriggerSelector>(refResolver, sourceMap, paths)); yield return(new ExpressionPropertyConverter <ChoiceSet>()); yield return(new ActivityTemplateConverter()); }
public DialogDebugAdapter(IDebugTransport transport, ISourceMap sourceMap, IBreakpoints breakpoints, Action terminate, IEvents events = null, ICodeModel codeModel = null, IDataModel dataModel = null, ILogger logger = null, ICoercion coercion = null) { _transport = transport ?? throw new ArgumentNullException(nameof(transport)); _events = events ?? new Events <DialogEvents>(); _codeModel = codeModel ?? new CodeModel(); _dataModel = dataModel ?? new DataModel(coercion ?? new Coercion()); _sourceMap = sourceMap ?? throw new ArgumentNullException(nameof(sourceMap)); _breakpoints = breakpoints ?? throw new ArgumentNullException(nameof(breakpoints)); _terminate = terminate ?? (() => Environment.Exit(0)); _logger = logger ?? NullLogger.Instance; _arenas.Add(_output); // lazily complete circular dependency _transport.Accept = AcceptAsync; }
public virtual IPersistenceEngine GetPersistenceEngine(ISourceMap sourceMap) { if (sourceMap == null) { throw new ArgumentException("sourceMap"); } IPersistenceEngine persistenceEngine = (IPersistenceEngine)dataSourcePersistenceEngines[sourceMap]; if (persistenceEngine == null) { persistenceEngine = GetPersistenceEngine(sourceMap.PersistenceType); } return(persistenceEngine); }
public override IEnumerable <JsonConverter> GetConverters(ISourceMap sourceMap, IRefResolver refResolver, Stack <string> paths) { yield return(new InterfaceConverter <OnCondition>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <TestAction>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <EntityRecognizer>(refResolver, sourceMap, paths)); yield return(new InterfaceConverter <ITriggerSelector>(refResolver, sourceMap, paths)); yield return(new IntExpressionConverter()); yield return(new NumberExpressionConverter()); yield return(new StringExpressionConverter()); yield return(new ValueExpressionConverter()); yield return(new BoolExpressionConverter()); yield return(new DialogExpressionConverter(refResolver, sourceMap, paths)); yield return(new ObjectExpressionConverter <ChoiceSet>()); yield return(new ObjectExpressionConverter <ChoiceFactoryOptions>()); yield return(new ObjectExpressionConverter <FindChoicesOptions>()); yield return(new ArrayExpressionConverter <string>()); yield return(new ArrayExpressionConverter <Choice>()); yield return(new EnumExpressionConverter <ActionChangeType>()); yield return(new EnumExpressionConverter <ArrayChangeType>()); yield return(new EnumExpressionConverter <AttachmentOutputFormat>()); yield return(new EnumExpressionConverter <ListStyle>()); yield return(new EnumExpressionConverter <ChoiceOutputFormat>()); yield return(new ChoiceSetConverter()); yield return(new ActivityTemplateConverter()); yield return(new JObjectConverter(refResolver)); }
/// <summary> /// Create an instance of a source map writer of the given name and from the given base stream. /// </summary> /// <param name="writer">base stream</param> /// <param name="implementationName">implementation name to create</param> /// <returns>instance of a source map writer</returns> public static ISourceMap Create(TextWriter writer, string implementationName) { ISourceMap implementation = null; // which implementation to instantiate? if (string.Compare(implementationName, V3SourceMap.ImplementationName, StringComparison.OrdinalIgnoreCase) == 0) { implementation = new V3SourceMap(writer); } else if (string.Compare(implementationName, ScriptSharpSourceMap.ImplementationName, StringComparison.OrdinalIgnoreCase) == 0) { implementation = new ScriptSharpSourceMap(writer); } return(implementation); }
protected virtual string GetDirectoryForDomain(IClassMap classMap) { ISourceMap sourceMap = classMap.GetDocSourceMap(); if (sourceMap == null) { throw new MappingException("Can't find Document Source Map for '" + classMap.GetFullName() + "' in the npersist xml mapping file!"); // do not localize } string directory = sourceMap.DocPath; if (!(Directory.Exists(directory))) { throw new NPersistException("Can't find directory: " + directory); // do not localize } return(directory); }
private bool HasCount(ref int count) { IContext context = interceptable.GetInterceptor().Context; PropertyStatus propStatus = context.ObjectManager.GetPropertyStatus(interceptable, propertyName); if (propStatus != PropertyStatus.NotLoaded) { return(false); } IInverseHelper inverseHelper = interceptable as IInverseHelper; if (inverseHelper == null) { return(false); } ITransaction tx = null; ConsistencyMode readConsistency = context.ReadConsistency; if (readConsistency == ConsistencyMode.Pessimistic) { IClassMap classMap = context.DomainMap.MustGetClassMap(interceptable.GetType()); ISourceMap sourceMap = classMap.GetSourceMap(); if (sourceMap != null) { if (sourceMap.PersistenceType.Equals(PersistenceType.ObjectRelational) || sourceMap.PersistenceType.Equals(PersistenceType.Default)) { tx = context.GetTransaction(context.GetDataSource(sourceMap).GetConnection()); if (tx == null) { return(false); } } } } if (inverseHelper.HasCount(propertyName, tx)) { count = inverseHelper.GetCount(propertyName, tx); return(true); } return(false); }
private void EnsureReadConsistency(object obj, string propertyName) { IContext ctx = this.Context; if (ctx.ReadConsistency.Equals(ConsistencyMode.Pessimistic)) { IIdentityHelper identityHelper = obj as IIdentityHelper; if (identityHelper == null) { throw new NPersistException(string.Format("Object of type {0} does not implement IIdentityHelper", obj.GetType())); } IClassMap classMap = ctx.DomainMap.MustGetClassMap(obj.GetType()); ISourceMap sourceMap = classMap.GetSourceMap(); if (sourceMap != null) { if (sourceMap.PersistenceType.Equals(PersistenceType.ObjectRelational) || sourceMap.PersistenceType.Equals(PersistenceType.Default)) { ITransaction tx = ctx.GetTransaction(ctx.GetDataSource(sourceMap).GetConnection()); if (tx == null) { throw new ReadConsistencyException( string.Format("A read consistency exception has occurred. The property {0} for the object of type {1} and with identity {2} was loaded or initialized with a value outside of a transaction. This is not permitted in a context using Pessimistic ReadConsistency.", propertyName, obj.GetType(), ctx.ObjectManager.GetObjectIdentity(obj)), obj); } Guid txGuid = identityHelper.GetTransactionGuid(); if (!(tx.Guid.Equals(txGuid))) { throw new ReadConsistencyException( string.Format("A read consistency exception has occurred. The property {0} for the object of type {1} and with identity {2} has already been loaded or initialized inside a transactions with Guid {3} and was now loaded or initialized again under another transaction with Guid {4}. This is not permitted in a context using Pessimistic ReadConsistency.", propertyName, obj.GetType(), ctx.ObjectManager.GetObjectIdentity(obj), txGuid, tx.Guid), txGuid, tx.Guid, obj); } } } } }
private void ValidateDatabaseDateRange(object obj, IPropertyMap propertyMap, IList exceptions) { if (propertyMap.Column.Length > 0) { IObjectManager om = this.Context.ObjectManager; IColumnMap columnMap = propertyMap.GetColumnMap(); if (columnMap != null) { if (columnMap.DataType.Equals(DbType.DateTime) || columnMap.DataType.Equals(DbType.Time) || columnMap.DataType.Equals(DbType.Date)) { if (!(om.GetNullValueStatus(obj, propertyMap.Name))) { ISourceMap sourceMap = propertyMap.GetSourceMap(); if (sourceMap != null) { object rawValue = om.GetPropertyValue(obj, propertyMap.Name); if (rawValue == null) { //all ok } else { DateTime value = (DateTime)rawValue; if (sourceMap.SourceType == SourceType.MSSqlServer) { DateTime minDate = new DateTime(1753, 1, 1, 0, 0, 0); if (value < minDate) { string template = "Validation error in object {0}.{1} , property {2}: " + Environment.NewLine + "Sql server can not handle date/time values lower than 1753-01-01 00:00:00"; string result = String.Format( template, propertyMap.ClassMap.Name, this.Context.ObjectManager.GetObjectKeyOrIdentity(obj), propertyMap.Name); HandleException(obj, propertyMap.Name, exceptions, new ValidationException(result), minDate, value, value); } } } } } } } } }
public ComposerBot(string rootDialogFile, ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, ISourceMap sourceMap) { this.conversationState = conversationState; this.userState = userState; this.dialogState = conversationState.CreateProperty <DialogState>("DialogState"); this.sourceMap = sourceMap; this.resourceExplorer = resourceExplorer; this.rootDialogFile = rootDialogFile; DeclarativeTypeLoader.AddComponent(new QnAMakerComponentRegistration()); // auto reload dialogs when file changes this.resourceExplorer.Changed += (resources) => { if (resources.Any(resource => resource.Id == ".dialog")) { Task.Run(() => this.LoadRootDialogAsync()); } }; LoadRootDialogAsync(); }
public override void Copy(IMap mapObject) { ISourceMap sourceMap = (ISourceMap)mapObject; sourceMap.PersistenceType = this.PersistenceType; sourceMap.ConnectionString = this.ConnectionString; sourceMap.Name = this.Name; sourceMap.ProviderType = this.ProviderType; sourceMap.SourceType = this.SourceType; sourceMap.Schema = this.Schema; sourceMap.Catalog = this.Catalog; sourceMap.ProviderAssemblyPath = this.ProviderAssemblyPath; sourceMap.ProviderConnectionTypeName = this.ProviderConnectionTypeName; sourceMap.DocPath = this.DocPath; sourceMap.DocRoot = this.DocRoot; sourceMap.DocEncoding = this.DocEncoding; sourceMap.Url = this.Url; sourceMap.DomainKey = this.DomainKey; }
public static void FromSourceMapAttribute(SourceMapAttribute attrib, ISourceMap sourceMap) { sourceMap.Name = attrib.Name; sourceMap.Catalog = attrib.Catalog; sourceMap.Compute = attrib.Compute; sourceMap.ConnectionString = attrib.ConnectionString; sourceMap.DocEncoding = attrib.DocEncoding; sourceMap.DocPath = attrib.DocPath; sourceMap.DocRoot = attrib.DocRoot; sourceMap.DomainKey = attrib.DomainKey; sourceMap.PersistenceType = attrib.PersistenceType; sourceMap.ProviderAssemblyPath = attrib.ProviderAssemblyPath; sourceMap.ProviderConnectionTypeName = attrib.ProviderConnectionTypeName; sourceMap.ProviderType = attrib.ProviderType; sourceMap.Schema = attrib.Schema; sourceMap.SourceType = attrib.SourceType; sourceMap.Url = attrib.Url; sourceMap.LockTable = attrib.LockTable; }
/// <summary> /// Enable Debug Adapter Protocol for the running adapter. /// </summary> /// <param name="botAdapter">The <see cref="BotAdapter"/> to enable.</param> /// <param name="port">port to listen on.</param> /// <param name="sourceMap">ISourceMap to use (default will be SourceMap()).</param> /// <param name="terminate">Termination function (Default is Environment.Exit().</param> /// <param name="logger">ILogger to use (Default is NullLogger).</param> /// <returns>The <see cref="BotAdapter"/>.</returns> public static BotAdapter UseDebugger( this BotAdapter botAdapter, int port, ISourceMap sourceMap = null, Action terminate = null, ILogger logger = null) { DebugSupport.SourceMap = sourceMap ?? new DebuggerSourceMap(new CodeModel()); return(botAdapter.Use( #pragma warning disable CA2000 // Dispose objects before losing scope (excluding, the object ownership is transferred to the adapter and the adapter should dispose it) new DialogDebugAdapter( port, DebugSupport.SourceMap, DebugSupport.SourceMap as IBreakpoints, terminate, codeModel: new CodeModel(), logger: logger))); #pragma warning restore CA2000 // Dispose objects before losing scope }
private void SetTransactionGuid(object obj) { IIdentityHelper identityHelper = obj as IIdentityHelper; if (identityHelper == null) { throw new NPersistException(string.Format("Object of type {0} does not implement IIdentityHelper", obj.GetType())); } IContext ctx = this.Context; IClassMap classMap = ctx.DomainMap.MustGetClassMap(obj.GetType()); ISourceMap sourceMap = classMap.GetSourceMap(); if (sourceMap != null) { if (sourceMap.PersistenceType.Equals(PersistenceType.ObjectRelational) || sourceMap.PersistenceType.Equals(PersistenceType.Default)) { IDataSource ds = ctx.GetDataSource(sourceMap); if (ds != null && ds.HasConnection()) { ITransaction tx = ctx.GetTransaction(ds.GetConnection()); //This may throw if ReadConsistency is Pessimistic and a tx guid has already been set... if (tx != null) { identityHelper.SetTransactionGuid(tx.Guid); } else { identityHelper.SetTransactionGuid(Guid.Empty); } } else { identityHelper.SetTransactionGuid(Guid.Empty); } } } }
public SqlSelectStatement(ISourceMap sourceMap) : base(sourceMap) { SetupClauses(); }
public virtual void SetSourceMap(ISourceMap SourceMap) { m_Source = SourceMap.Name; }
public void Visit(ISourceMap sourceMap) { ; }
public virtual IPersistenceEngine GetPersistenceEngine(ISourceMap sourceMap) { if (sourceMap == null) throw new ArgumentException("sourceMap"); IPersistenceEngine persistenceEngine = (IPersistenceEngine) dataSourcePersistenceEngines[sourceMap]; if (persistenceEngine == null) { persistenceEngine = GetPersistenceEngine(sourceMap.PersistenceType); } return persistenceEngine; }
public void SetSourceMap(ISourceMap value) { throw new Exception("The method or operation is not implemented."); }
public virtual IDataSource GetDataSource(ISourceMap sourceMap) { string name = sourceMap.Name; return (IDataSource) m_hashDataSources[name]; }
public static void FromSourceMapAttribute(SourceMapAttribute attrib, ISourceMap sourceMap) { sourceMap.Name = attrib.Name; sourceMap.Catalog = attrib.Catalog ; sourceMap.Compute = attrib.Compute; sourceMap.ConnectionString = attrib.ConnectionString ; sourceMap.DocEncoding = attrib.DocEncoding ; sourceMap.DocPath = attrib.DocPath ; sourceMap.DocRoot = attrib.DocRoot ; sourceMap.DomainKey = attrib.DomainKey ; sourceMap.PersistenceType = attrib.PersistenceType ; sourceMap.ProviderAssemblyPath = attrib.ProviderAssemblyPath ; sourceMap.ProviderConnectionTypeName = attrib.ProviderConnectionTypeName ; sourceMap.ProviderType = attrib.ProviderType ; sourceMap.Schema = attrib.Schema ; sourceMap.SourceType = attrib.SourceType ; sourceMap.Url = attrib.Url ; sourceMap.LockTable = attrib.LockTable; }
public virtual ISourceMap GetSourceMap() { if (fixedGetSourceMap) return fixedValueGetSourceMap; ISourceMap sourceMap = null; if (this.Source == "") { sourceMap = m_ClassMap.GetSourceMap(); } else { sourceMap = m_ClassMap.DomainMap.GetSourceMap(this.Source); } if (isFixed) { fixedValueGetSourceMap = sourceMap; fixedGetSourceMap = true; } return sourceMap; }
public SqlDatabase(SqlStatement sqlStatement, ISourceMap sourceMap) { this.Parent = sqlStatement; this.sourceMap = sourceMap; }
public virtual void VerifySourceMap(ISourceMap sourceMap) { if (sourceMap.Name.Length < 1) { HandleVerifyException(sourceMap, "Source name must not be empty!", "Name"); // do not localize } if (this.Recursive) { foreach (ITableMap tableMap in sourceMap.TableMaps) { tableMap.Accept(this); } } Hashtable hashNames = new Hashtable(); foreach (ITableMap tableMap in sourceMap.TableMaps) { if (tableMap.Name.Length > 0) { if (hashNames.ContainsKey(tableMap.Name.ToLower(CultureInfo.InvariantCulture))) { HandleVerifyException(sourceMap, "Table names must not appear in duplicates! (Source: '" + sourceMap.Name + "', Table name: '" + tableMap.Name + "')", "TableMaps"); // do not localize } } hashNames[tableMap.Name.Length] = "1"; } }
protected SqlStatement(ISourceMap sourceMap) { this.sqlDatabase = new SqlDatabase(this, sourceMap); this.sqlAliasGenerator = new SqlDefaultAliasGenerator(this); }
protected virtual void DoDeepCopy(ISourceMap sourceMap) { ITableMap cloneTableMap; foreach (ITableMap tableMap in this.TableMaps) { cloneTableMap = (ITableMap) tableMap.DeepClone(); cloneTableMap.SourceMap = sourceMap; } }
protected virtual void DeserializeTableMap(ISourceMap sourceMap, XmlNode xmlTable) { ITableMap tableMap = new TableMap(); XmlNodeList xmlCols; tableMap.SourceMap = sourceMap; if (!(xmlTable.Attributes["name"] == null)) { tableMap.Name = xmlTable.Attributes["name"].Value; } if (!(xmlTable.Attributes["view"] == null)) { tableMap.IsView = ParseBool(xmlTable.Attributes["view"].Value); } ArrayList metaData = tableMap.MetaData; DeserializeMetaData(xmlTable, ref metaData); xmlCols = xmlTable.SelectNodes("column"); foreach (XmlNode xmlCol in xmlCols) { DeserializeColumnMap(tableMap, xmlCol); } }
protected virtual string SerializeSourceMap(ISourceMap sourceMap) { StringBuilder xml = new StringBuilder(); xml.Append(" <source name=\"" + sourceMap.Name + "\""); // do not localize if (sourceMap.PersistenceType != PersistenceType.Default) { xml.Append(" persistence-type=\"" + sourceMap.PersistenceType.ToString() + "\""); // do not localize } xml.Append(" type=\"" + sourceMap.SourceType.ToString() + "\""); // do not localize xml.Append(" provider=\"" + sourceMap.ProviderType.ToString() + "\""); // do not localize if (sourceMap.Schema.Length > 0) { xml.Append(" schema=\"" + sourceMap.Schema + "\""); // do not localize } if (sourceMap.Catalog.Length > 0) { xml.Append(" catalog=\"" + sourceMap.Catalog + "\""); // do not localize } if (sourceMap.ProviderAssemblyPath.Length > 0) { xml.Append(" provider-path=\"" + sourceMap.ProviderAssemblyPath + "\""); // do not localize } if (sourceMap.ProviderConnectionTypeName.Length > 0) { xml.Append(" provider-conn=\"" + sourceMap.ProviderConnectionTypeName + "\""); // do not localize } if (sourceMap.DocPath.Length > 0) { xml.Append(" doc-path=\"" + sourceMap.DocPath + "\""); // do not localize } if (sourceMap.DocRoot.Length > 0) { xml.Append(" doc-root=\"" + sourceMap.DocRoot + "\""); // do not localize } if (sourceMap.DocEncoding.Length > 0) { xml.Append(" doc-encoding=\"" + sourceMap.DocEncoding + "\""); // do not localize } if (sourceMap.Url.Length > 0) { xml.Append(" url=\"" + sourceMap.Url + "\""); // do not localize } if (sourceMap.DomainKey.Length > 0) { xml.Append(" domain-key=\"" + sourceMap.DomainKey + "\""); // do not localize } xml.Append(">\r\n"); xml.Append(" <connection-string>" + sourceMap.ConnectionString + "</connection-string>\r\n"); // do not localize xml.Append(SerializeMetaData(sourceMap.MetaData, " ")); foreach (ITableMap tableMap in sourceMap.TableMaps) { xml.Append(SerializeTableMap(tableMap)); } xml.Append(" </source>\r\n"); // do not localize return xml.ToString(); }
public virtual void SetPersistenceEngine(ISourceMap sourceMap, IPersistenceEngine persistenceEngine) { dataSourcePersistenceEngines[sourceMap] = persistenceEngine ; persistenceEngine.Context = this.Context; }
public virtual void SetSourceMap(ISourceMap value) { m_Source = value.Name; }
public SqlInsertStatement(ISourceMap sourceMap) : base(sourceMap) { SetupClauses(); }
public SqlDeleteStatement(ISourceMap sourceMap) : base(sourceMap) { SetupClauses(); }
public virtual void Visit(ISourceMap sourceMap) { VerifySourceMap(sourceMap); }