protected virtual void Initializer(string connectionString, string tableName, ModelToTableMapper <T> mapper, IList <string> updateOf, DmlTriggerType dmlTriggerType, bool automaticDatabaseObjectsTeardown, string namingConventionForDatabaseObjects) { if (mapper != null && mapper.Count() == 0) { throw new ModelToTableMapperException("Empty mapper"); } if (!dmlTriggerType.HasFlag(DmlTriggerType.Update) && !dmlTriggerType.HasFlag(DmlTriggerType.All)) { if (updateOf != null && updateOf.Any()) { throw new DmlTriggerTypeException("updateOf parameter can be specified only if DmlTriggerType parameter contains DmlTriggerType.Update too, not for DmlTriggerType.Delete or DmlTriggerType.Insert only."); } } this.TraceLevel = TraceLevel.Off; CreateMirrorTable(connectionString, updateOf, tableName, namingConventionForDatabaseObjects); _connectionString = connectionString; _mapper = mapper ?? this.GetModelMapperFromColumnDataAnnotation(); _updateOf = updateOf; _userInterestedColumns = GetUserInterestedColumns(updateOf); _automaticDatabaseObjectsTeardown = automaticDatabaseObjectsTeardown; _dataBaseObjectsNamingConvention = GeneratedataBaseObjectsNamingConvention(namingConventionForDatabaseObjects); _needsToCreateDatabaseObjects = CheckIfNeedsToCreateDatabaseObjects(); _dmlTriggerType = dmlTriggerType; }
protected virtual void CheckUpdateOfCongruenceWithTriggerType(IUpdateOfModel <T> updateOf, DmlTriggerType dmlTriggerType) { if (updateOf == null || updateOf.Count() == 0) { return; } if (!dmlTriggerType.HasFlag(DmlTriggerType.Update) && !dmlTriggerType.HasFlag(DmlTriggerType.All)) { if (updateOf.Count() > 0) { throw new DmlTriggerTypeException("updateOf parameter can be specified only if DmlTriggerType parameter contains DmlTriggerType.Update too, not for DmlTriggerType.Delete or DmlTriggerType.Insert only."); } } }