示例#1
0
        public Relationship SetOutProperty(string name, PropertyType type, bool nullable = true)
        {
            if (OutProperty != null)
            {
                throw new InvalidOperationException("There is already an in property defined.");
            }

            switch (type)
            {
            case PropertyType.Lookup:
                OutEntity.AddLookup(name, InEntity, nullable);
                break;

            case PropertyType.Collection:
                OutEntity.AddCollection(name, InEntity);
                break;

            default:
                throw new NotSupportedException();
            }
            OutProperty = OutEntity.Properties[name];
            OutProperty.Relationship = this;
            OutProperty.Direction    = DirectionEnum.Out;

            // StaticData
            OutEntity.DynamicEntityPropertyAdded(OutProperty);

            return(this);
        }
示例#2
0
        public static JsonResult LoadProducts(string currentUserId, string acessToken, string currentSendParameter)
        {
            var     list    = new List <dynamic>();
            dynamic person1 = new ExpandoObject();

            person1.Icon      = "http://172.16.23.60:8005/test/product4.png";
            person1.LocalIcon = "";
            person1.FirstName = "Ellen1";
            person1.LastName  = "Adams1";
            list.Add(person1);

            dynamic person2 = new ExpandoObject();

            person2.Icon      = "http://172.16.23.60:8006/api/stream/product4.png";
            person2.LocalIcon = "";
            person2.FirstName = "Ellen2";
            person2.LastName  = "Adams2";
            list.Add(person2);

            dynamic person3 = new ExpandoObject();

            person3.Icon      = "http://172.16.23.60:8006/api/stream/product4.png";
            person3.LocalIcon = "";
            person3.FirstName = "Ellen3";
            person3.LastName  = "Adams3";
            list.Add(person3);

            OutEntity oe = new OutEntity();

            oe.ErrorCode = ErrorCode.Success;
            oe.ReturnObj = list;

            return(new JsonResult(oe));
        }
示例#3
0
        public int AddToOutQueue(DbSaveableEntity saveableEntity)
        {
            var asString  = saveableEntity.getJson();
            var outEntity = new OutEntity()
            {
                Id       = saveableEntity.Id.Value,
                DataBlob = asString
            };
            var res = new OutDb().DB.InsertOrReplace(outEntity);

            return(res);
        }
示例#4
0
        void IRefactorRelationship.SetOutEntity(Entity target, bool allowLosingData)
        {
            Parent.EnsureSchemaMigration();

            if (target.IsSubsclassOf(OutEntity))
            {
                if (!allowLosingData)
                {
                    throw new ArgumentException(string.Format("Target {0} is a sub type of {1}, you could lose data. If you want to do this anyway, you can set allowLosingData to true.", target.Name, OutEntity.Name), "baseType");
                }

                foreach (var item in OutEntity.GetSubclasses())
                {
                    if (item.IsAbstract || item.IsVirtual)
                    {
                        continue;
                    }

                    if (item.IsSelfOrSubclassOf(target))
                    {
                        continue;
                    }

                    //delete relations
                    Parent.Templates.RemoveRelationship(template =>
                    {
                        template.InEntity  = InEntity.Label.Name;
                        template.Relation  = Neo4JRelationshipType;
                        template.OutEntity = item.Label.Name;
                    }).RunBatched();
                }
            }
            else if (!OutEntity.IsSubsclassOf(target))
            {
                throw new ArgumentException(string.Format("Target {0} is not a base or sub type of {1}. Consider using 'Reroute'.", target.Name, OutEntity.Name), "baseType");
            }

            if (OutProperty != null)
            {
                OutEntity.Properties.Remove(OutProperty.Name);
                target.Properties.Add(OutProperty.Name, OutProperty);
                OutProperty.SetParentEntity(target);
            }
            if (InProperty != null)
            {
                InProperty.SetReturnTypeEntity(target);
            }

            OutInterface = new Interface(target);
        }
示例#5
0
        public static JsonResult PushTest(string currentUserId, string acessToken, string currentSendParameter)
        {
            Byte[] bytes     = Convert.FromBase64String(currentSendParameter);
            string imagepath = string.Format(@"{0}\Resource\Test\{1}.jpg", Directory.GetCurrentDirectory(), Guid.NewGuid().ToString());

            using (FileStream fs = new FileStream(imagepath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                fs.Write(bytes, 0, bytes.Length);
                fs.Flush();
            }
            OutEntity oe = new OutEntity();

            oe.ErrorCode = ErrorCode.Success;
            oe.ReturnObj = "Works";
            return(new JsonResult(oe));
        }
示例#6
0
 public OutEntityUnsynced load(OutEntity initial)
 {
     Id       = initial.Id;
     DataBlob = initial.DataBlob;
     return(this);
 }