Beispiel #1
0
 public NHMetadataBuilder(ISessionFactory sessionFactory, IBreezeConfig breezeConfig, IBreezeConfigurator breezeConfigurator)
 {
     _sessionFactory       = sessionFactory;
     _breezeConfig         = breezeConfig;
     _breezeConfigurator   = breezeConfigurator;
     _pluralizationService = new PluralizationServiceInstance(CultureInfo.GetCultureInfo("en-us"));
 }
Beispiel #2
0
 /// <summary>
 ///     Creates a new context using the session and metadata from the sourceContext
 /// </summary>
 /// <param name="sourceContext">source of the Session and metadata used by this new context.</param>
 /// <param name="eventPublisher">Used for publishing events</param>
 public BreezeContext(BreezeContext sourceContext, IEventPublisher eventPublisher) : base(sourceContext._breezeConfig)
 {
     _eventPublisher     = eventPublisher;
     Session             = sourceContext.Session;
     _breezeConfigurator = sourceContext._breezeConfigurator;
     _metadata           = sourceContext.GetMetadata();
 }
Beispiel #3
0
 /// <summary>
 /// Create new instance with the given saveMap and fkMap.  Since the saveMap is unique per save,
 /// this instance will be useful for processing one entire save bundle only.
 /// </summary>
 /// <param name="saveMap">Map of entity types -> entity instances to save.  This is provided by Breeze in the SaveChanges call.</param>
 /// <param name="fkMap">Map of relationship name -> foreign key name.  This is built in the NHBreezeMetadata class.</param>
 /// <param name="session">NHibernate session that will save the entities</param>
 /// <param name="breezeConfigurator"></param>
 public NhRelationshipFixer(Dictionary <Type, List <EntityInfo> > saveMap, IDictionary <string, string> fkMap, ISession session,
                            IBreezeConfigurator breezeConfigurator)
 {
     this._saveMap            = saveMap;
     this._fkMap              = fkMap;
     this._session            = session;
     this._breezeConfigurator = breezeConfigurator;
     this._dependencyGraph    = new Dictionary <EntityInfo, List <EntityInfo> >();
 }
Beispiel #4
0
 public ValidatedBreezeContext(
     ISession session,
     IBreezeConfig breezeConfig,
     IBreezeConfigurator breezeConfigurator,
     IEventPublisher eventPublisher,
     Container container) : base(breezeConfig, session, breezeConfigurator, eventPublisher)
 {
     _container = container;
 }
Beispiel #5
0
 /// <summary>
 /// Constructs an instance of <see cref="BreezeContractResolver"/>.
 /// </summary>
 public BreezeContractResolver(
     IBreezeConfigurator breezeConfigurator,
     IEntityMetadataProvider entityMetadataProvider,
     IClientModelMetadataProvider clientModelMetadataProvider,
     ILazyLoadGuardProvider lazyLoadGuardProvider)
 {
     _breezeConfigurator          = breezeConfigurator;
     _entityMetadataProvider      = entityMetadataProvider;
     _clientModelMetadataProvider = clientModelMetadataProvider;
     _lazyLoadGuardProvider       = lazyLoadGuardProvider;
 }
 /// <summary>
 /// Constructs an instance of <see cref="BreezeMetadataBuilder"/>.
 /// </summary>
 public BreezeMetadataBuilder(
     INHibernateClassMetadataProvider classMetadataProvider,
     IEntityMetadataProvider entityMetadataProvider,
     IBreezeConfigurator breezeConfigurator,
     IClientModelMetadataProvider clientModelMetadataProvider,
     IPropertyValidatorsProvider propertyValidatorsProvider,
     IDataTypeProvider dataTypeProvider)
 {
     _classMetadataProvider       = classMetadataProvider;
     _entityMetadataProvider      = entityMetadataProvider;
     _breezeConfigurator          = breezeConfigurator;
     _clientModelMetadataProvider = clientModelMetadataProvider;
     _propertyValidatorsProvider  = propertyValidatorsProvider;
     _dataTypeProvider            = dataTypeProvider;
 }
Beispiel #7
0
 private static void Configure(IBreezeConfigurator configurator)
 {
     configurator.ConfigureModelMembers(o => typeof(IClientModel).IsAssignableFrom(o),
                                        (member, o) =>
     {
         if (member.GetCustomAttribute <NotNullAttribute>() != null)
         {
             o.IsNullable(false);
         }
     });
     configurator.ConfigureModelMembers(o => typeof(IVersionedEntity).IsAssignableFrom(o),
                                        (member, o) =>
     {
         if (VersionedEntityProperties.Contains(member.Name))
         {
             o.IsNullable(true);
             o.Deserialize(false);
         }
     });
 }
Beispiel #8
0
 /// <summary>
 /// Creates a new context using the session and metadata from the sourceContext
 /// </summary>
 /// <param name="sourceContext">source of the Session and metadata used by this new context.</param>
 public NHContext(NHContext sourceContext)
 {
     this.session            = sourceContext.Session;
     this.breezeConfigurator = sourceContext.breezeConfigurator;
     this._metadata          = sourceContext.GetMetadata();
 }
Beispiel #9
0
 /// <summary>
 /// Create a new context for the given session.
 /// Each thread should have its own NHContext and Session.
 /// </summary>
 /// <param name="session">Used for queries and updates</param>
 /// <param name="breezeConfigurator">Used for get configurations</param>
 public NHContext(ISession session, IBreezeConfigurator breezeConfigurator)
 {
     this.session            = session;
     this.breezeConfigurator = breezeConfigurator;
 }
 public NHibernateContractResolver(Func <Type, IClassMetadata> getMetadataFunc, IBreezeConfigurator breezeConfigurator)
 {
     _breezeConfigurator = breezeConfigurator;
     _getMetadataFunc    = getMetadataFunc;
 }
Beispiel #11
0
 /// <summary>
 ///     Create a new context for the given session.
 ///     Each thread should have its own NHContext and Session.
 /// </summary>
 /// <param name="breezeConfig">Used for breeze config</param>
 /// <param name="session">Used for queries and updates</param>
 /// <param name="breezeConfigurator">Used for get configurations</param>
 /// <param name="eventPublisher">Used for publishing events</param>
 public BreezeContext(IBreezeConfig breezeConfig, ISession session, IBreezeConfigurator breezeConfigurator, IEventPublisher eventPublisher) : base(breezeConfig)
 {
     Session             = session;
     _breezeConfigurator = breezeConfigurator;
     _eventPublisher     = eventPublisher;
 }