public ConventionSet() { ConfigurationConventions = new IConvention[0]; ConceptualModelConventions = new IConvention[0]; ConceptualToStoreMappingConventions = new IConvention[0]; StoreModelConventions = new IConvention[0]; }
public DefaultConfiguration(ConnectionStringSettings connectionStringSettings, IConvention mappingConvention, IEngine engine) : base( engine, connectionStringSettings, DbProviderFactories.GetFactory(connectionStringSettings.ProviderName), new DefaultMapper(mappingConvention), new DefaultSessionFactory()) { }
public TeamFoundationService(ITeamFoundationVersionControlAdapter versoControlAdapterAdapter, IConvention convention, ITextOutputService textOutputService) { if(convention == null) throw new ArgumentNullException("convention"); this.VersionControlAdapter = versoControlAdapterAdapter; this.Convention = convention; this.TextOutput = textOutputService; }
public MergeBugfixController(IVersionControlService versionControlService, IUserInputService userInputService, IConvention convention) { if(versionControlService == null) throw new ArgumentNullException("versionControlService"); if(convention == null) throw new ArgumentNullException("convention"); this.VersionControl = versionControlService; this.UserInput = userInputService; this.Convention = convention; }
public EnvironmentService(IFileExecutionService fileExecutionService, IFileSystemAdapter fileSystemAdapter, IConvention convention) { if(fileExecutionService == null) throw new ArgumentNullException("fileExecutionService"); if(convention == null) throw new ArgumentNullException("convention"); this.FileExecution = fileExecutionService; this.FileSystemAdapter = fileSystemAdapter; this.Convention = convention; }
public MsBuildService(IFileExecutionService fileExecutionService, IConvention convention, ISettings settings) { if(convention == null) throw new ArgumentNullException("convention"); if(settings == null) throw new ArgumentNullException("settings"); this.FileExecution = fileExecutionService; this.Convention = convention; this.Settings = settings; }
public AdeNetService(IFileExecutionService fileExecutionService, IConvention convention, ISettings settings, ITextOutputService textOutputService) { if(convention == null) throw new ArgumentNullException("convention"); if(settings == null) throw new ArgumentNullException("settings"); this.FileExecution = fileExecutionService; this.Convention = convention; this.Settings = settings; this.TextOutput = textOutputService; }
public RemoveReleasebranchController(IVersionControlService versionControlService, IFileSystemAdapter fileSystemAdapter, IConvention convention, ITextOutputService textOutputService) { if(versionControlService == null) throw new ArgumentNullException("versionControlService"); if(textOutputService == null) throw new ArgumentNullException("textOutputService"); this.VersionControl = versionControlService; this.FileSystem = fileSystemAdapter; this.Convention = convention; this.TextOutput = textOutputService; }
/// <summary> /// Initializes a new instance of the <see cref="StandardFluentMapper"/> class. /// </summary> /// <param name="assembly">The assembly.</param> public StandardFluentMapper(Assembly assembly) { Assembly = assembly; Conventions = new IConvention[] { new TableConvention(), new PrimaryKeyConvention(), new ForeignKeyConvention() }; }
public void Configure(MappingConfiguration mappingConfig) { var assemblies = Assembly.GetAssembly(typeof (Entity)); var conventions = new IConvention[] { DefaultCascade.All(), ConventionBuilder.Id.Always(m => m.GeneratedBy.HiLo("1000")), ConventionBuilder.HasMany.Always(m => m.Inverse()) }; mappingConfig.AutoMappings.Add( AutoMap.Assemblies(new AutoMapConfig(), assemblies) .Conventions.Add(conventions)); }
public GetLatestController(IVersionControlService versionControlService, IAdeNetExeAdaper adeNetExeAdapter, IBuildEngineService buildEngineService, IDatabaseService databaseService, IEnvironmentService environmentService, IConvention convention, ITextOutputService textOutputService) { if(versionControlService == null) throw new ArgumentNullException("versionControlService"); if(adeNetExeAdapter == null) throw new ArgumentNullException("adeNetExeAdapter"); if(buildEngineService == null) throw new ArgumentNullException("buildEngineService"); if(databaseService == null) throw new ArgumentNullException("databaseService"); if(environmentService == null) throw new ArgumentNullException("environmentService"); this.VersionControl = versionControlService; this.AdeNet = adeNetExeAdapter; this.BuildEngine = buildEngineService; this.Database = databaseService; this.Environment = environmentService; this.Convention = convention; this.TextOutput = textOutputService; }
public static IConvention[] Get() { var defaultCoventions = new IConvention[] { new PrimaryKeyConvention(), new DefaultClassConvention(), new DefaultForeignKeyConvention(), //new DefaultManytoManyConvention(), new EnumConvention(), new DefaultOneToManyTableNameConvention(), new DefaultStringPropertyConvention(), new DefaultHasManyToManyConvention(), new BinaryColumnLengthConvention(), DefaultLazy.Always() }; return defaultCoventions; }
public RemoveMappingController(IVersionControlService versionControlService, IAdeNetExeAdaper adeNetExeAdapter, IFileSystemAdapter fileSystemAdapter, IDatabaseService databaseService, IAblageService ablageService, IEnvironmentService environmentService, IConvention convention, ITextOutputService textOutputService) { if(versionControlService == null) throw new ArgumentNullException("versionControlService"); if(adeNetExeAdapter == null) throw new ArgumentNullException("adeNetExeAdapter"); if(fileSystemAdapter == null) throw new ArgumentNullException("fileSystemAdapter"); if(databaseService == null) throw new ArgumentNullException("databaseService"); if(ablageService == null) throw new ArgumentNullException("ablageService"); if(convention == null) throw new ArgumentNullException("convention"); this.VersionControl = versionControlService; this.AdeNetExeAdapter = adeNetExeAdapter; this.FileSystem = fileSystemAdapter; this.Database = databaseService; this.Ablage = ablageService; this.Environment = environmentService; this.Convention = convention; this.TextOutput = textOutputService; }
public PropertyConfigurationConventionDispatcher( IConvention convention, Type propertyConfigurationType, PropertyInfo propertyInfo, Func <PropertyConfiguration> propertyConfiguration, ModelConfiguration modelConfiguration) { Check.NotNull(convention, "convention"); Check.NotNull(propertyConfigurationType, "propertyConfigurationType"); Check.NotNull(propertyInfo, "propertyInfo"); Check.NotNull(propertyConfiguration, "propertyConfiguration"); _convention = convention; _propertyConfigurationType = propertyConfigurationType; _propertyInfo = propertyInfo; _propertyConfiguration = propertyConfiguration; _modelConfiguration = modelConfiguration; }
/// <summary> /// Add a convention to fixture /// </summary> /// <param name="convention">new convention</param> public void Add(IConvention convention) { if (convention == null) { throw new ArgumentNullException(nameof(convention)); } var typedConvention = convention as ITypedConvention; if (typedConvention != null) { _typedConventions.AddConvention(typedConvention); } else { _conventions.AddConvention(convention); } }
public void AddBefore <TExistingConvention>(IConvention newConvention) where TExistingConvention : IConvention { Check.NotNull(newConvention, "newConvention"); var typeMissmatch = true; if (ConventionsTypeFilter.IsConfigurationConvention(newConvention.GetType()) && ConventionsTypeFilter.IsConfigurationConvention(typeof(TExistingConvention))) { typeMissmatch = false; Insert(typeof(TExistingConvention), 0, newConvention, _configurationConventions); } if (ConventionsTypeFilter.IsConceptualModelConvention(newConvention.GetType()) && ConventionsTypeFilter.IsConceptualModelConvention(typeof(TExistingConvention))) { typeMissmatch = false; Insert(typeof(TExistingConvention), 0, newConvention, _conceptualModelConventions); } if (ConventionsTypeFilter.IsStoreModelConvention(newConvention.GetType()) && ConventionsTypeFilter.IsStoreModelConvention(typeof(TExistingConvention))) { typeMissmatch = false; Insert(typeof(TExistingConvention), 0, newConvention, _storeModelConventions); } if (ConventionsTypeFilter.IsConceptualToStoreMappingConvention(newConvention.GetType()) && ConventionsTypeFilter.IsConceptualToStoreMappingConvention(typeof(TExistingConvention))) { typeMissmatch = false; Insert(typeof(TExistingConvention), 0, newConvention, _conceptualToStoreMappingConventions); } if (typeMissmatch) { throw new InvalidOperationException( Strings.ConventionsConfiguration_ConventionTypeMissmatch( newConvention.GetType(), typeof(TExistingConvention))); } }
public void Execute <TDataSource>(IConvention <TDataSource> convention, TDataSource data) where TDataSource : IConventionData { conventionReason = convention.ConventionReason; if (!data.HasData) { throw new ConventionSourceInvalidException(String.Format("{0} has no data", data.Description)); } convention.Execute(data, this); if (!resultSet) { throw new ResultNotSetException("{0} did not set a result, conventions must always set a result"); } foreach (IResultsProcessor resultsProcessor in processors) { resultsProcessor.Process(this, ConventionResults); } }
/// <summary> /// Setup application's convention. /// </summary> private static void SetupConventions() { var conventions = new IConvention[] { new StringObjectIdIdGeneratorConvention(), new CamelCaseElementNameConvention() }; var idx = 0; foreach (var convention in conventions) { var pack = new ConventionPack(); pack.Add(convention); ConventionRegistry.Register( string.Format("TrincaBarbecueApi.Conventions[{0}]", idx++), pack, t => true); } }
public void Setup() { _ontologies = new Mock<IOntologyProvider>(); _ontologies.Setup(o => o.ResolveUri(It.IsAny<string>(), It.IsAny<string>())) .Returns((string p, string t) => GetUri(p, t)); _mappingsRepository = new MappingsRepository(); foreach (var mappingSource in CreateMappingSources()) { MappingsRepository.AddSource(GetType().Assembly, mappingSource); } IEnumerable<IConvention> conventions = new IConvention[] { new DefaultDictionaryKeyPredicateConvention(), new DefaultDictionaryValuePredicateConvention(), new CollectionStorageConvention(), new RdfListConvention() }; MappingsRepository.RebuildMappings(new MappingContext(_ontologies.Object, conventions)); }
ISessionFactory InitializeSessionFactory() { var conventions = new IConvention[] { Table.Is(x => x.EntityType.Name.ToLowerInvariant()), // All table names are lower case ForeignKey.EndsWith("Id"), // Foreign key references end with Id DefaultLazy.Always() // Enable Lazy-Loading by default } .Concat(DatabaseConventions.NeverNull()) .ToArray(); var config = Fluently.Configure() .Database(DatabaseConfiguration) .Mappings(m => m.FluentMappings .AddFromAssemblyOf <DatabaseAdapter>() .Conventions.Add(conventions)); nhConfig = config.BuildConfiguration(); sessionFactory = config.BuildSessionFactory(); return(sessionFactory); }
public ConventionManager(Assembly scanAssembly, IConvention attachmentConvention, IConvention viewConvention, IConvention viewModelConvention) { this.attachmentConvention = attachmentConvention; this.viewConvention = viewConvention; this.viewModelConvention = viewModelConvention; attachmentTypes = scanAssembly.GetTypes().Where(attachmentConvention.Filter).ToList(); viewTypes = scanAssembly.GetTypes().Where(viewConvention.Filter).ToList(); viewModelTypes = scanAssembly.GetTypes().Where(viewModelConvention.Filter).ToList(); foreach (var item in attachmentTypes) { attachmentConvention.Verify(item); } foreach (var item in viewTypes) { viewConvention.Verify(item); } foreach (var item in viewModelTypes) { viewModelConvention.Verify(item); } }
private static void Register(IConvention convention, IConventionContext context) { var interfaces = convention.GetType().GetTypeInfo().ImplementedInterfaces .Where(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IConvention <>)) .Select(x => x.GetTypeInfo().GenericTypeArguments[0]); var contextTypes = context.GetType().GetTypeInfo().ImplementedInterfaces .Where(x => typeof(IConventionContext).IsAssignableFrom(x)); var typesToRegister = interfaces .Join(contextTypes, x => x, x => x, (_, contextType) => contextType); foreach (var item in typesToRegister) { if (!_registerMethodCache.TryGetValue(item, out var method)) { method = RegisterGenericMethod.MakeGenericMethod(item); _registerMethodCache.TryAdd(item, method); } method.Invoke(null, new object[] { convention, context }); } }
public void ShouldReturnAllConventions() { var scanner = AutoFake.Resolve <Scanner>(); A.CallTo( () => AutoFake.Resolve <IAssemblyCandidateFinder>().GetCandidateAssemblies(A <IEnumerable <string> > ._) ) .Returns(Array.Empty <Assembly>()); IConvention convention = A.Fake <IServiceConvention>(); IConvention convention2 = A.Fake <ITestConvention>(); IConvention convention3 = A.Fake <IServiceConvention>(); IConvention convention4 = A.Fake <ITestConvention>(); scanner.PrependConvention(convention, convention2); scanner.AppendConvention(convention3, convention4); var provider = scanner.BuildProvider(); var result = provider.GetAll() .Select(x => x.Convention); result.Should().ContainInOrder(convention, convention2, convention3, convention4); }
public static ISchemaBuilder TryAddConvention <T>( this ISchemaBuilder builder, IConvention convention, string?scope = null) where T : IConvention => builder.TryAddConvention(typeof(T), convention, scope);
public virtual QueryExpression Translate(IConvention convention) { return(this); }
protected override Repository CreateRepository(IConvention convention) { return new InMemoryRepository { Convention = convention }; }
public override QueryExpression Translate(IConvention convention) { return(new NotExpression(Expression.Translate(convention))); }
public static Action <IServiceLocator> Convention(IConvention convention) { return(convention.Build()); }
/// <summary> /// Create a convention /// </summary> /// <param name="convention">The convention.</param> /// <param name="hostType">The host type.</param> internal DelegateOrConvention(IConvention convention, HostType hostType) { Convention = convention; Delegate = default; HostType = hostType; }
public static IRequestExecutorBuilder TryAddConvention <T>( this IRequestExecutorBuilder builder, IConvention convention, string?scope = null) where T : IConvention => builder.ConfigureSchema(b => b.TryAddConvention(typeof(T), convention, scope));
ISessionFactory InitializeSessionFactory() { var conventions = new IConvention[] { Table.Is(x => x.EntityType.Name.ToLowerInvariant()), // All table names are lower case ForeignKey.EndsWith("Id"), // Foreign key references end with Id DefaultLazy.Always() // Enable Lazy-Loading by default } .Concat(DatabaseConventions.NeverNull()) .ToArray(); var config = Fluently.Configure() .Database(DatabaseConfiguration) .Mappings(m => m.FluentMappings .AddFromAssemblyOf<DatabaseAdapter>() .Conventions.Add(conventions)); nhConfig = config.BuildConfiguration(); sessionFactory = config.BuildSessionFactory(); return sessionFactory; }
public ModelGenerator(IConvention convention) { this.convention = convention; }
public IocConfig AddConvention(IConvention convention) { _conventions.Add(convention); return this; }
public void Setup() { _convention = (IConvention<IPropertyMappingProvider>)(_defaultConvertersConvention = new DefaultConvertersConvention()); }
public bool IsForType(Type type, IConvention convention) { return !HasTableQualifiedAlias || TableName == convention.GetTableName(type); }
public void Remove(IConvention convention) { _conventions.Remove(convention); }
public override QueryExpression Translate(IConvention convention) { var columnName = convention.GetColumnName(_propertyInfo); return new PropertyExpression(columnName, PropertyType); }
public bool Contains(IConvention item) => FinderFunc(f => f.Conventions.Any(t => item.GetType().IsAssignableFrom(t)));
public override QueryExpression Translate(IConvention convention) { var columnName = convention.GetColumnName(_propertyInfo); return(new PropertyExpression(columnName, PropertyType)); }
public bool Remove(IConvention item) { throw new NotImplementedException(); }
public void Insert(int index, IConvention convention) { _conventions.Insert(index, convention); }
public int IndexOf(IConvention item) { throw new NotImplementedException(); }
public ConventionReader(IConvention convention) { _convention = convention; }
public void Insert(int index, IConvention item) { throw new NotImplementedException(); }
public IConventionsPolicy <TEntity> SatisfiedAs(IConvention <TEntity> convention) { _convensPolicy.Add(convention); return(_convensPolicy); }
public AblageService(IFileSystemAdapter fileSystemAdapter, IConvention convention) { this.FileSystemAdapter = fileSystemAdapter; this.Convention = convention; }
public void AddConventionApplicant(IConvention convention) { _conventionApplicant = convention; }
public override QueryExpression Translate(IConvention convention) { return(Create( (PropertyExpression)PropertyExpression.Translate(convention), (ValueExpression)ValueExpression.Translate(convention))); }
public DefaultConfiguration(ConnectionStringSettings connectionStringSettings, IConvention mappingConvention) : this(connectionStringSettings, mappingConvention, new SqlEngine(new DialectFactory().Create(connectionStringSettings))) { }
public void AddConvention(IConvention convention) { Guard.IsNotNull(convention, "convention"); _conventions.Add(convention); }
//public PropertyConvention(Func<TEntity, TEntityProperty> getter, IConvention<TEntityProperty> propConvention) public PropertyConvention(Func <IConventionParams <TEntity>, IConventionParams <TEntityProperty> > getter, IConvention <TEntityProperty> propConvention) { _getter = getter; _propConvention = propConvention; }
/// <summary> /// Retuns a new specification adding this one with the passed one. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="rightHand">The right hand.</param> /// <param name="leftHand">The left hand.</param> /// <returns></returns> public static IConvention <TEntity> And <TEntity>(this IConvention <TEntity> rightHand, IConvention <TEntity> leftHand) { return(new ComposeConvention <TEntity>(rightHand, leftHand, ComposeType.And)); }
public Engineer(IConvention convention) { this.convention = convention; this.typeMap = new Dictionary<string, Type>(); this.manyToOneColumns = new Dictionary<string, IList<IColumn>>(); this.InitTypeGenerator(); }
/// <summary> /// Retuns a new specification or'ing this one with the passed one. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="rightHand">The right hand.</param> /// <param name="leftHand">The left hand.</param> /// <returns></returns> public static IConvention <TEntity> Or <TEntity>(IConvention <TEntity> rightHand, IConvention <TEntity> leftHand) { return(new ComposeConvention <TEntity>(rightHand, leftHand, ComposeType.Or)); }
public bool IsForType(Type type, IConvention convention) { return(!HasTableQualifiedAlias || TableName == convention.GetTableName(type)); }
/// <summary> /// Retuns a new specification or'ing this one with the passed one. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="rightHand">The right hand.</param> /// <param name="leftHand">The left hand.</param> /// <returns></returns> public static IConvention <TEntity> Not <TEntity>(IConvention <TEntity> convension) { return(new NotConvention <TEntity>(convension)); }
public NotConvention(IConvention <TEntity> convension) { _convension = convension; }
/// <summary> /// Create a convention /// </summary> /// <param name="convention">The convention.</param> internal DelegateOrConvention(IConvention convention) { Convention = convention; Delegate = default; HostType = HostType.Undefined; }
public AdeNetExeAdapter(IFileExecutionService fileExecutionService, IConvention convention, ISettings settings) { this.FileExecution = fileExecutionService; this.Convention = convention; this.Settings = settings; }
public void Add(IConvention convention) { _conventions.Add(convention); }