Exemplo n.º 1
0
        private StorageColumnInfo GetColumnInfo(StorageModel model, TypeInfo type, string fieldName)
        {
            var resolver = Upgrader.MappingResolver;
            var table    = model.Tables[resolver.GetNodeName(type)];
            var field    = type.Fields[fieldName];

            return(table.Columns[field.MappingName]);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Called to update the fields describing <see cref="Entity"/>'s version.
 /// </summary>
 /// <param name="changedEntity">The changed entity.</param>
 /// <param name="changedField">The changed field.</param>
 /// <returns>
 /// <see langword="True"/>, if <see cref="VersionInfo"/> was changed;
 /// otherwise, <see langword="false"/>.
 /// </returns>
 protected virtual bool UpdateVersion(Entity changedEntity, FieldInfo changedField)
 {
     foreach (var field in TypeInfo.GetVersionFields().Where(f => f.AutoVersion))
     {
         SetFieldValue(field, VersionGenerator.GenerateNextVersion(GetFieldValue(field)));
     }
     return(true);
 }
Exemplo n.º 3
0
        // Constructors

        public FieldAccessorProvider(TypeInfo typeInfo)
        {
            var fields = typeInfo.Fields;

            fieldAccessors = new FieldAccessor[fields.Count == 0 ? 0 : (fields.Max(field => field.FieldId) + 1)];
            foreach (var field in fields)
            {
                if (field.FieldId != FieldInfo.NoFieldId)
                {
                    fieldAccessors[field.FieldId] = CreateFieldAccessor(field);
                }
            }
        }
Exemplo n.º 4
0
        protected Operation(QueryProvider queryProvider)
        {
            QueryProvider = queryProvider;
            var entityType = typeof(T);
            var session    = queryProvider.Session;

            DomainHandler = session.Domain.Services.Get <DomainHandler>();
            TypeInfo      = GetTypeInfo(entityType);
            var mapping = session.StorageNode.Mapping;

            PrimaryIndexes = TypeInfo.AffectedIndexes
                             .Where(i => i.IsPrimary)
                             .Select(i => new PrimaryIndexMapping(i, mapping[i.ReflectedType]))
                             .ToArray();
            QueryBuilder = session.Services.Get <QueryBuilder>();
        }