Skip to content

Commit

Permalink
release 1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
hhblaze committed Dec 8, 2020
1 parent b8503d1 commit cf7a156
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 185 deletions.
32 changes: 11 additions & 21 deletions EntitySyncing.Net5/EntitySyncing.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 11 additions & 21 deletions EntitySyncing.NetStandard20/EntitySyncing.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion EntitySyncingClient.Net5/EntitySyncingClient.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion EntitySyncingClient.NetStandard20/EntitySyncingClient.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions EntitySyncingClientTester/Entites/Entity_Task.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

namespace EntitySyncingClientTester
{
public partial class Entity_Task : EntitySyncingClient.ISyncEntity
{

}


[ProtoBuf.ProtoContract]
public partial class Entity_Task
Expand All @@ -28,16 +25,25 @@ public partial class Entity_Task
public string Description { get; set; }
}

/// <summary>
/// Add on the client-side together with entity itself
/// </summary>
public partial class Entity_Task : EntitySyncingClient.ISyncEntity
{

}


///// <summary>
///// Must be unremarked and Entity_Task_Server must be remarked on the server-side, having in both client and server one entity
///// !!!!!!!!!!!! Add on the client-side together with entity itself
///// </summary>
//public partial class Entity_Task : Entity_Task, EntitySyncing.ISyncEntity
//{

//}

/// <summary>
/// HERER IT IS ONLY FOR EMULATING REASONS
/// For emulating reasons inside the same project entity receives another name Entity_Task_Server.
/// </summary>
[ProtoBuf.ProtoContract]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override void Init()
//this.entityTable
//this.GetContentTable
//this.SyncingEngine
//this.ptrContent
//this.ptrContent

//Here extra DBreeze transaction tables can be synchronized (this.entityTable and probably this.entityContentTable (if it differes) must be also added in the SynchronizeTables)

Expand Down
61 changes: 4 additions & 57 deletions EntitySyncingClientTester/Entites/SyncEntity_Task_Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ namespace EntitySyncingClientTester

class SyncEntity_Task_Server : EntitySyncingBaseV1<Entity_Task_Server>
{
//List<GM_IDoThings.TaskDescriptionTemplate> ents = new List<GM_IDoThings.TaskDescriptionTemplate>();
//string tblText = "";
//string mcTbl = "";
//long companyId = -1;

public override void Init()

{
//Available:

//this.tran
//this.entityTable
//this.GetContentTable
//this.SyncingEngine
//this.ptrContent
//this.userToken



//Here extra DBreeze transaction tables can be synchronized (this.entityTable and probably this.entityContentTable (if it differes) must be also added in the SynchronizeTables)

Expand Down Expand Up @@ -60,62 +59,10 @@ public override bool OnInsertEntity(Entity_Task_Server entity, Entity_Task_Serve
}


//public override bool OnInsertEntity(long entityKey, GM_IDoThings.TaskDescriptionTemplate entity, GM_IDoThings.TaskDescriptionTemplate oldEntity, long newEntitySyncTimestamp)
//{
// entity.SyncTimestamp = newEntitySyncTimestamp;


// bool entityExist = oldEntity != null;

// if (entityExist)
// {
// //Update
// //Reforming secondary indicies
// entity.CreatorId = oldEntity.CreatorId;
// }
// else
// {
// entity.CreatorId = this.user.Id;
// }

// //en.Id = entityKey; //!!!!!!!!!!! THEY MUST BE EQUAL CHECK IF IT IS SO
// //en.CompanyID = this.user.CompanyId;
// //Inserting value
// //this.refToValueDataBlockWithFixedAddress is either set or null if entity is new
// this.refToValueDataBlockWithFixedAddress = tran.InsertDataBlockWithFixedAddress<GM_IDoThings.TaskDescriptionTemplate>(entityTable, this.refToValueDataBlockWithFixedAddress, entity);
// //Inserting primary key
// if (!entityExist)
// tran.Insert<byte[], byte[]>(entityTable, new byte[] { 200 }.Concat(entityKey.To_8_bytes_array_BigEndian()), this.refToValueDataBlockWithFixedAddress);

// //Handling search words
// // tran.TextInsert(this.entityTable + "_TEXT", entityKey.To_8_bytes_array_BigEndian(), en.GetSearchWordsContains(), fullMatchWords: en.GetFull()
// tran.TextInsert(tblText, entityKey.To_8_bytes_array_BigEndian(), entity.GetSearchWordsContains() ?? String.Empty, entity.GetSearchWordsFull() ?? String.Empty,
// deferredIndexing: true);

// ents.Add(entity);

// return true; //Yes we insert new entity
//}

public override void AfterCommit()
{
base.AfterCommit();

////No MCache
//using (var mctran = MCache.CreateTransaction())
//{
// foreach (var ent in ents)
// {
// ISyncEntity sent = ent as ISyncEntity;

// mctran.Remove<string>(this.mcTbl, this.companyId + "," + sent.Id);

// if (!sent.Deleted)
// mctran.Insert<string, GM_IDoThings.TaskDescriptionTemplate>(this.mcTbl, this.companyId + "," + sent.Id, ent);
// }

// mctran.Publish();
//}
}

}
Expand Down
30 changes: 6 additions & 24 deletions SPEntitySyncing/EntitySyncingBaseV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ public abstract class EntitySyncingBaseV1<T>
/// <summary>
///
/// </summary>
/// <param name="entityTable"></param>
/// <param name="entityKey"></param>
/// <param name="entity"></param>
/// <param name="oldEntity"></param>
/// <param name="newEntitySyncTimestamp"></param>
/// <param name="oldEntity"></param>
/// <returns>TRUE - indicates that incoming entity must be applied. FALSE means that this entity is not so strong by political reasons as server-side one and must be changed with server-side.</returns>
public virtual bool OnInsertEntity(T entity, T oldEntity)
{
return true;
}


/// <summary>
/// Will be set automatically and will be available in entity handler
/// </summary>
public DBreeze.Transactions.Transaction tran = null;

public string entityTable = "";
/// <summary>
/// In case if value of the entity differs from the table where synchronizer holds data
Expand All @@ -42,27 +42,9 @@ public string GetEntityContentTable
get { return String.IsNullOrEmpty(entityContentTable) ? entityTable : entityContentTable; }
}

//public long TopicId = 0; //In case if synchronization comes from the specific APP
//public bool TopicIdDependantSync = false;

//public virtual bool CheckTopicIdEntity(T entityValue)
//{
// return true;
//}

/// <summary>
/// Also responisble for Synchronize table, by default we synchronize only one master table, so we don't need extra tran.Synchronize tables
/// </summary>
/// <param name="tran"></param>
/// <param name="entityTable"></param>
/// <param name="companyId"></param>
/// <param name="syncOperations"></param>
//public virtual void Init(DBreeze.Transactions.Transaction tran, List<SyncOperation> syncOperations, object user, string TopicName = "")
public virtual void Init()
{
//GccObjects.Net.UserManagement.GccUserRemoteView
//this.tran = tran;
//this.userToken = user;

}


Expand Down
4 changes: 1 addition & 3 deletions SPEntitySyncing/ISyncEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ namespace EntitySyncing
public interface ISyncEntity
{
long SyncTimestamp { get; set; }
/// <summary>
/// Must be always ID of the local storage (for Mobile - LocalID, for Server - ServerID)
/// </summary>

long Id { get; set; }

bool Deleted { get; set; }
Expand Down
9 changes: 6 additions & 3 deletions SPEntitySyncing/SyncStrategyV1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ namespace EntitySyncing
public class SyncStrategyV1<T>
{


/// <summary>
/// Fills up index 200. Entity desired ID and SyncTimestamp must be specified.
/// Creation of transaction, synchronization of the table and transaction commit is outside of this function.
/// Fills up index 200. Creation of transaction, synchronization of the table and transaction commit is outside of this function.
/// Entity desired ID and SyncTimestamp must be specified
/// </summary>
/// <param name="table">where index 200 must be stored </param>
/// <param name="tran"></param>
/// <param name="table">Where must be stored index 200</param>
/// <param name="entity">entity.Id and entity.SyncTimestamp must be filled up</param>
/// <param name="ptrEntityContent">pointer to the entity content (16 bytes) gathered with DBreeze InsertDataBlockWithFixedAddress</param>
/// <param name="oldEntity">old instance of the entity from DB</param>
public static void InsertIndex4Sync(DBreeze.Transactions.Transaction tran, string table, ISyncEntity entity, byte[] ptrEntityContent, ISyncEntity oldEntity)
{
if (oldEntity == null)
Expand Down
Loading

0 comments on commit cf7a156

Please sign in to comment.